Hello,
I'm trying to translate my own application written in PyGTK on Windows.
This is what I did:
First of all my test application *translate.py* stored in c:\Python:
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gettext
import locale
gettext.install('translate','locale')
locale.setlocale(locale.LC_ALL, '')
print locale.getdefaultlocale()
class HelloWorld:
def destroy(self, widget, data=None):
gtk.main_quit()
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("destroy", self.destroy)
self.window.set_border_width(10)
self.button = gtk.Button(_("Hello world"))
self.button.connect("clicked", self.destroy, None)
self.window.add(self.button)
self.window.show_all()
def main(self):
gtk.main()
if __name__ == "__main__":
translate = HelloWorld()
translate.main()
I installed gettext for Windows and according to
/http://faq.pygtk.org/index.py?req=show&file=faq22.002.htp/ did next steps:
1) Extract strings to a .pot file using xgettext
2) Create cs.po file using msginit
3) Translated the cs.po file with PSPad.
4) Compile the cs.po file to cs.mo using msgfmt
5) Copy the cs.mo to /c:\Python\locale\cs_CZ\LC_MESSAGES\translate.mo/
Now I expected my test application to start with the Czech translation I
made. But it still shows the original "Hello World" string. The
function locale.getdefaultlocale()[0] returns "cs_CZ" so I do believe my
language is set correctly.
Do you have any ideas what am I doing wrong?
Many thanks and best regards,
Vlada
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/