[pygtk] change language on-the-fly

Jonas jonas.ska at gmail.com
Wed Aug 25 04:39:28 WST 2010


Hello,

I'm trying to make my program internationalized, but there's a problem - I  
can't get it to change the language on the fly:

langs += ["lt_LT", "en_US"]

gettext.bindtextdomain(APP_NAME, local_path)
gettext.textdomain(APP_NAME)

lang = gettext.translation(APP_NAME, local_path, languages=['en_US'],  
fallback = False)
lang1 = gettext.translation(APP_NAME, local_path, languages=['lt_LT'],  
fallback = False)

gettext.install(APP_NAME, local_path, unicode = False, codeset = 'utf-8')

if I execute lang1.install() at the start, it all goes well.
if I execute lang1.install() , for example, when a button is clicked, it  
does nothing.

Tried printing a string to console - it works. On the GUI, it doesn't.
http://docs.python.org/release/2.5.2/lib/node740.html states it should  
work.
Is this even possible with PyGTK? Or should I manually execute set_text()  
on every element?

Thanks in advance.
Jonas


More information about the pygtk mailing list