Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10507

Re: multilanguage application - step by step

Date 2011-07-29 11:42 +0200
From Thomas Jollans <t@jollybox.de>
Subject Re: multilanguage application - step by step
References <7fd80314-2c01-4141-9139-9899b34f6408@z14g2000yqh.googlegroups.com> <CABFuWSx7snrFxk=3CsGNLUWgbSzkTVy807JJUKo5OQfgSg7RNg@mail.gmail.com> <CAMZYqRTKwVNO6tW8XSuvb7ntJnuRSWUmU=7iFymuozjXrGb8zg@mail.gmail.com> <CABFuWSx0ORD4wcR0QC193pYM_g-XBve40G9wbJ8SHyN5weXczA@mail.gmail.com> <CABFuWSweWdNqgVMzhp1Wp=U1W4jFhRoJcE-bsyNLeBQfV-Bufw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1608.1311932533.1164.python-list@python.org> (permalink)

Show all headers | View raw


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.

Thomas

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

multilanguage application - step by step miamia <peterirbizon@gmail.com> - 2011-07-28 01:59 -0700
  Re: multilanguage application - step by step Chris Rebert <clp2@rebertia.com> - 2011-07-28 02:24 -0700
  Re: multilanguage application - step by step Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-28 05:19 -0500
  Re: multilanguage application - step by step Thomas Jollans <t@jollybox.de> - 2011-07-28 14:36 +0200
  Re: multilanguage application - step by step Thomas Jollans <t@jollybox.de> - 2011-07-29 11:42 +0200

csiph-web