[pygtk] i18n and Glade
shawn bright
nephish at gmail.com
Mon Mar 12 02:46:37 WST 2007
Hey there,
i use your wonderful editor. The way i made it work for Arch Linux was
to change my local. Then it worked. Don't know if this helps. But
great work on your project.
shawn
On 3/10/07, Justin Mazzola Paluska <jmp at mit.edu> wrote:
> On Sat, Mar 10, 2007 at 11:47:05PM +0000, Mystilleef wrote:
> > 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)
>
> Have you tried putting the glade internationalization before the
> python one? Or putting the locale before all of the binding? I've
> also never used gettext.install. The following seems to work in my
> application:
>
> import locale
> import gettext
> import gtk
> import gtk.glde
>
> locale.setlocale(locale.LC_ALL, '')
> # see http://bugzilla.gnome.org/show_bug.cgi?id=344926 for why the
> # next two commands look repeated.
> gtk.glade.bindtextdomain(GETTEXT_DOMAIN,
> LOCALE_PATH)
> gtk.glade.textdomain(GETTEXT_DOMAIN)
> gettext.bindtextdomain(GETTEXT_DOMAIN,
> LOCALE_PATH)
> gettext.textdomain(GETTEXT_DOMAIN)
>
> > 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?
>
> This is a silly question, but you did extract the strings from your
> GUI to a po file, right?
> —Justin
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
More information about the pygtk
mailing list