[I18n-sig] Internationalizing a module-application like a module or like an application?

"Martin v. Löwis" martin at v.loewis.de
Thu May 19 22:29:53 CEST 2005


Philippe Collet wrote:
> I don't know if i have to internationalize it like a module or like an 
> application, regarded to
> python.active-venture.com/lib/node276.html.
> Is anyone having any idea?

You can *always* use gettext in the "like a module" mode, even for
applications. The only disadvantage is that you have to modify every
module; for the "application" case, you override the global _, so
it automatically applies to all modules in the application.

If you have multiple .py files, and if one of them is somehow
a config/setup file (say, "mysetup.py"), you could write into
all other modules

from mysetup import _

and into mysetup.py

import gettext
t = gettext.translation('spam', '/usr/share/locale')
_ = t.gettext

Regards,
Martin


More information about the I18n-sig mailing list