Hello,
Now I would like to make my wxPython application multilingual, or at least read a language dictionary. Only I am still a litte bit confused, there is the Python locale, there is wxLocale, and I am missing the big picture. What I tried to do is aattached. Some questions:
1. Apparantly I need to install something for gettext.
What does the parameter passed to the install method mean ?
2. What is the role of Python's locale if wxLocale is used.
What is the relation to the gettext install method ?
3. When adding a Catalog, what is the syntax. Apparently it is a file.
Should it be a .mo or a.po, or just the basename, and AddCatablog
will look for both ?
4. What are the search directories ?
5. What is the search order for language catalogue, default, then
additional ones ? For example if I redefine "File" ?
6. Is the python gettext method called for a _(""),
or wxGetTranslation().
In the first case, where does gettext look for the text ?
7. Is there a sample application somewhere.
The internat in the wxWindows sample dir does not really help me.
Thanks for any hints.
peter
···
---
#!/usr/bin/env python
from wxPython.wx import *
class Ctest(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
l = wxLocale()
l.Init(wxLANGUAGE_GERMAN)
l.AddCatalog("test.po")
self.frame = wxFrame(None, -1, _("Test Title"),
style=wxDEFAULT_FRAME_STYLE)
self.SetTopWindow(self.frame)
self.frame.Show(True)
return True
if __name__ == "__main__":
import gettext
gettext.install("test")
test = Ctest()
test.MainLoop()