Localisation

Martin v. Loewis martin at v.loewis.de
Sun Jan 13 16:28:33 EST 2002


fgranger at alussinan.org (=?ISO-8859-1?Q?Fran=E7ois_Granger?=) writes:

> I do a program which need lists of strings. These strings will be
> different according to the choosen language.

I'd recommend to use gettext for that, see

http://www.python.org/doc/current/lib/module-gettext.html

> According to a language variable = 'FR', I would do:
> from lang.language import *
> 
> Well, it is not _that_ simple otherwise I would not ask.
> 
> Anyone who can give a help to push on the right direction ?

If you really want to use your custom technique, then

exec ("from %s import *" % lang)

should work.

HTH,
Martin



More information about the Python-list mailing list