[PyQt] i18n & combo box

Frédéric frederic.mantegazza at gbiloba.org
Fri Feb 13 15:26:39 GMT 2009


I have a little issue with i18n and combobox. I have a config dialog with
some combobox, to allow the user to choose some pre-defined values. For
example, the possible entries of one of my combobox are:

    up
    down
    left
    right

which are translated, in french, by:

    haut
    bas
    gauche
    droite

I store the user choice string in the config. file (based on the standard
ConfigParser module). But when I setup the combobox, to pre-select the
default choice (when the application is started the first time), I get
nothing, because strings do not match! Here is my code:

orientationComboBox.setCurrentIndex(self._view.orientationComboBox.findText(self._model.headOrientation))

and to store back the value from teh combobox:

self._model.headOrientation =
str(self._view.orientationComboBox.currentText())

With PyGTK, all was working fine; internal used strings where the
original ones, not translated ones. Is there a way to have the same
behaviour under PyQt?

Thanks,

PS: I don't want the translated  strings stored in the config. file,
because it will lead to problems if the user change the locale, or if
they ask for some help.


--
   Frédéric



More information about the PyQt mailing list