multilanguage application - step by step

Thomas Jollans t at
Fri Jul 29 11:42:15 CEST 2011

On 29/07/11 11:18, Peter Irbizon wrote:
> Hello Thomas,
> > The usual way of using gettext is to use the system locale to determine
> > the right language. Of course, you can have different translations and
> > install() them (I expect), but you'll have to re-load all the strings
> > displayed in your application when you switch language, which might be
> > tricky.

> thank you now it works and all my string are translated. But as you
> said switching languages is small problem now. I am using pygtk and I
> have no idea how to re-load all strings in my app when I click on
> button with another language. Any idea?

Well, it depends on how you're constructing your interface. If you're
creating all the widgets in Python code, you could move all your
foo.text = "Bar"; statements to one method that updates the text for all
widgets, and call that both from the constructor and from the
language-switching event handler.

If you're using Glade, your only option might be to completely reload
the interface, but then you'd somehow have to save the user's data and
immediately restore it perfectly.


More information about the Python-list mailing list