[pygtk] i18n and Glade
Mystilleef
mystilleef at gmail.com
Sun Mar 11 08:47:05 WST 2007
Hello,
The glade generated GUIs in my project are not being localized. I have
tried initializing the python glade gettext functions but to no avail.
My i18n initialization function looks like this.
------------------------------------------------------------------------
from gettext import bindtextdomain, textdomain
from gettext import bind_textdomain_codeset, install
from locale import setlocale, LC_ALL, Error
bindtextdomain(appname, locale_folder)
textdomain(appname)
bind_textdomain_codeset(appname, "UTF-8")
install(appname, locale_folder, unicode=1)
try:
setlocale(LC_ALL, "")
except Error:
pass
####Glade Stuff.
from gtk.glade import bindtextdomain, textdomain
bindtextdomain(appname, locale_folder)
textdomain(appname)
------------------------------------------------------------------------
I also provide the domain as an argument when initializing the glade
GUI.
------------------------------------------------------------------------
from gtk.glade import XML
glade_object = XML(glade_file, WigdetName, domain=appname)
------------------------------------------------------------------------
i18n works fine for none-glade GUIs. My only problem is with glade
generated GUIs. Do I need to do anything special to get internalization
for glade generated GUIs? Anyone having this problem?
Thanks
More information about the pygtk
mailing list