i18n in a library
Alex Martelli
aleax at aleax.it
Wed Apr 23 04:33:19 EDT 2003
<posted & mailed>
Mathias Waack wrote:
> I'm using some different applications which all use the same package.
> Lets assume there are app "A" and "B" and a package "L". Now I've got
> a question regarding the translation of these apps:
>
> It's easy to prepare translation using gettext.py. But I don't want
> to include all strings from the library in each app. So I get 3
> files: A.po, B.po and L.po. Is it possible to setup the gettext
> module to use both A.po and L.po to lookup strings for app A?
>
> I think there must be a simple solution because this should be a
> common problem for each library writer. But I can't find a solution
> in the python docs:(
I think what you want is gettext.translation, which offers you
finer-grained control than gettext.install. I.e., within the
modules of library L, you could use
import gettext
_ = gettext.translation('L').ugettext
so that in those modules function _ will look things up in domain
'L', rather than in whatever domain is "installed" globally.
Alex
More information about the Python-list
mailing list