[pygtk] gtk.Builder and translation directory

Laszlo Pandy laszlok2 at gmail.com
Mon Mar 2 12:25:51 WST 2009


http://library.gnome.org/devel/gtk/2.11/GtkBuilder.html#GtkBuilder--translation-domain

"The translation domain used when translating property values that
have been marked as translatable in interface descriptions. If the
translation domain is NULL, GtkBuilder uses gettext(), otherwise
dgettext()."

That is, GtkBuilder uses gettext directly, so whatever translations
are loaded for gettext will be available for GtkBuilder.
Here is how to set the translation domain and directory for gettext.
It should then work, although I have not tested it specifically with
GtkBuilder.

>>> import gettext
>>> gettext.bindtextdomain("myapp", "/path/to/locale/dir/")
>>> gettext.textdomain("myapp")

Laszlo


2009/3/1 Osmo Salomaa <otsaloma at cc.hut.fi>:
> Hello list,
>
> I'm trying to move from Libglade to GtkBuilder and I have one problem
> remaining. gtk.glade had a bindtextdomain function (much like
> gettext.bindtextdomain) that took the translation directory as an
> argument. gtk.Builder seems to have a set_translation_domain method, but
> it's only for defining the domain. How do I set the directory where to
> search for translations to strings in GtkBuilder XML files?
>
> --
> Osmo Salomaa <otsaloma at cc.hut.fi>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>


More information about the pygtk mailing list