wxpython and wxlocale
Ya
tmartinez at ammsoft.com
Tue Jan 27 05:04:15 EST 2004
This is my code:
The button of "OK" is not translated.
What is wrong ?
#I have a mo file named myapp.mo for translate my own dialogs.
#its containt
#....
#....
#: myapp.py:23
#msgid "Hello World"
#msgstr "Bonjour Monde"
#...
#in this location .\locale\fr\LC_MESSAGES
import gettext
from wxPython.wx import *
import wx
import locale
import sys, os, time
def startapp(self):
self.loc = wx.Locale()
self.loc.Init(wx.LANGUAGE_FRENCH)
gettext.translation("myapp", ".\locale",languages=['fr']).install()
#display then message "Bonjour Monde", but the OK button not is
translate!!!!!
dlg = wxMessageDialog(None, _('Hello World'),'', wxOK |
wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
class BoaApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
startapp(self)
return True
def main():
try:
demopath= os.path.dirname(__file__)
os.chdir(demopath)
except:
pass
application = BoaApp(0)
application.MainLoop()
if __name__ == '__main__':
main()
"Jarek Zgoda" <jzgoda at gazeta.usun.pl> escribió en el mensaje
news:bv403p$3ot$1 at atlantis.news.tpi.pl...
> Ya <tmartinez at ammsoft.com> pisze:
>
> > Is there any way of telling python that the text of the dialogues is in
a
> > specific language?
> > And in affirmative case. How is it made? since all the attempts have
been
> > useless.
> > I think that wxLocale has to be used, but I do not become clear.
>
> loc = wx.Locale()
> loc.Init(wx.LANGUAGE_POLISH)
>
> Et voila, your program uses Polish dialogs.
>
> --
> Jarek Zgoda
> Unregistered Linux User #-1
> http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/
More information about the Python-list
mailing list