Hey all. I've started tackling i18n stuff with wxPython and would
like some clarification along the way. I checked the archive but I
couldn't find anything that quite addressed what I'm looking for. Here
are the issues I've encountered with my explorations:
1) I use Python's gettext to install the _() per the usual python
approach and translate all my strings before they are fed to the
widgets. However, the gettext.install function MUST be called within
the OnInit() function within my wxApp instance. It appears that
wxPython overwrites my _() function during the init. This is slightly
annoying since I had to move some static class stuff (that did need to
be translated when imported the module) to within class instances. Not
a big deal, but is this how it's supposed to work? Is this just a
wxWindows thing?
2) Now I need to initialize the wxLocale part of wxPython so it
displays translated wxPython widgets as well. It seems that wxPython
isn't very synched with the wxWindows at this point (I'm using
2.4.0.2). The Init function requires a locale name to select the
appropriate language: how do I extract that name? I tried looking into
the using the locale module but was unsure of a method that produced
consistent results (I tried setting my LC_ALL to various values to
experiment with the behavior). How have others solved this problem?
3) Am I doing this correctly? Is there a preferred way? This seems
like a good Wiki topic.
-- Mike
···
--
Michael Gilfix
mgilfix@eecs.tufts.edu
For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html