Problems with gettext and py.crust

Werner F. Bruhin wrote:

David,

David Brown wrote:

I'm working on an application that supports multiple languages. At the start of my main module, I use:

__builtin__.dict__["_"] = wx.GetTranslation

Why are you doing it that way?

Isn't just doing this in your app working?
_ = wx.GetTranslation

That should work too - using __builtin__ is a trick I copied from the wxpython wiki as a way to define the _() function everywhere in the program without having to define it at the start of each module.

In my app I only use gettext but Boa uses wx.GetTranslation and just uses the above (there is a sample app in the Boa examples folder too).

Instead of using py.crust have you tried:
from wx.lib.mixins.inspection import InspectionMixin
class BoaApp(wx.App, InspectionMixin):
   def OnInit(self):
       self.Init() # for InspectionMixin

The wxPython demo uses this, press F6 in the demo, I use it in my app very handy to debug sizer issues etc and by default one activates it with ctrl-alt-i.

That's an interesting idea, which I had not heard of before now. I'll give that a try shortly - thanks for suggesting it.

By the way what version of wx and Python are you using?

Python 2.5 on Windows, with wx-2.8 (the versions on my work PC might be slightly newer, but the effect is the same there).