[wxPython-users] Re: wx.Locale mystery

Karsten Hilbert Karsten.Hilbert at gmx.net
Thu Dec 20 04:48:25 PST 2007


On Thu, Dec 20, 2007 at 02:07:23PM +0200, Donn Ingle wrote:

> > I do something like the following,
> I have just tried a 'mixture' of the two like that and it's still confusing. 
> 
> If I mix the two and then remove the line:
> _ = wx.GetTranslation
> The app now responds to print _("stuff") but the stock buttons are still all
> in English.
>  I don't think the wx.Locale stuff is doing anything at all - the gettext
> stuff is just working via _

In my (unicode-)wxPython programm I only ever initialize the
Python level gettext and _() all strings. With this the GUI
is translated nicely (into German) *including* stock
buttons. This is on wx2.6 and Python 2.4/2.5.

It is likely advisable to setup the locale and gettext
system *before* even importing any of the wx code such that
that code will find a pre-initialized locale in the context
of the running application (which might otherwise just be
"C" and thus in need of being set up for wx* by means of
wx-i18n functionality).

You may want to look at

	http://cvs.savannah.gnu.org/viewvc/gnumed/gnumed/client/pycommon/gmI18N.py?root=gnumed&view=log

to see how we are going about this business in GNUmed.

I don't think it's the business of wx* to setup the locale
and gettext system. (Same as I don't believe it's the job of
wx* to setup standard pathes - but, alas, the standard
library doesn't help with that.)

> > Also be sure that the wxLocale object remains alive during the
> > runtime of your program.
> How could I check? And what kills it?

Going out of scope would kill it, for one thing.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




More information about the wxpython-users mailing list