Thanks! I've just solved the problem by exploring wxPython.wx sources. There
is the way to get your app translated using wx without gettext, a tiny
tutorial for wxPython users like me:
Cross-platform National Language Support in wxPython without gettext
module
-------------------------------------------------------------------
The easiest way to learn is to look at the concrete example. This is the
example of simple do-nothing wxPython application.
Application directory: APP_DIR
Default system locale, for example: lt_LT
Application's specific locale directory: APP_DIR + locale
Files in APP_DIR (unix file separators):
myapp.py
locale/
locale/lt/
locale/lt/myapp.mo
File myapp.mo contains these sample translations:
"OK" -> "Gerai"
"Hello" -> "Labas"
The code:
from wxPython.wx import *
import os
class MyDoNotingApp(wxApp):
def OnInit(self):
wxLocale_AddCatalogLookupPathPrefix(os.path.join(APP_DIR, "locale"))
self.locale = wxLocale()
self.locale.Init(wxLANGUAGE_DEFAULT)
self.locale.AddCatalog("myapp")
# Test it
print wxGetTranslation("OK")
# If we want a shorter name:
_ = wxGetTranslation
print _("Hello")
return True
if __name__ == "__main__":
app = MyDoNothingApp(0)
app.MainLoop()
Testing:
$ python myapp.py
Gerai
Labas
I hope this letter will help someone in the future until wxPython demo
has a real i18n example.
Martynas Jocius
···
On Tue, Aug 26, 2003 at 12:38:26AM +0200, Alberto Griggio wrote:
Actually the function is called wxLocale_AddCatalogLookupPathPrefix (note
the underscore), but the functionality is there: I know it because I was
hit by this in the past...
--
There is more vision than meets the eye.
http://mjoc.sig.lt