[wxPython-users] Can't get wx.Locale to work

Robin Dunn robin at alldunn.com
Thu Feb 8 11:51:51 PST 2007


Eli Golovinsky wrote:
> I can't get the attached example to translate strings correctly.
> It works flawlessly with Python's gettext but I can get it to work with 
> wx.Locale.
> 
> And I need wx.Locale to work because many of the strings I'm translating 
> are in XRC that does the translation automatically via wx's current locale.
> 
> I'm probably missing something really simple, right?

Yep.

> def wx_setup():
>     app = wx.PySimpleApp()
> 
>     locale = wx.Locale(wx.LANGUAGE_SPANISH)
>     locale.AddCatalog('es')
>     __builtin__._ = wx.GetTranslation

You need to save a reference to the locale object.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list