i18n questions

Donn Ingle donn.ingle at gmail.com
Fri Dec 28 13:01:48 EST 2007


Hi,
 A soon-to-be happy new year to everyone!

I'm 100% new to this i18n lark and my approach so far has been to create
a .mo file per module in my app. 
 My thinking was, why load one huge .mo file when a single module only needs
a few strings? Since then, it seems, I have made the wrong decision.

For example I have module A that imports module B. Each one does this:

    gettext.install( domain, localedir, unicode = True )
    lang = gettext.translation(domain, localedir, languages = [ loc ] )
    lang.install(unicode = True )

(where doman is the name of the module, so "A" and "B")

The problem is that domain "A" loads and then import B happens and so
the "lang" reference (I think) gets replaced by domain "B" -- the result is
that module A can only translate strings that are in domain "B".

How does one 'merge' gettext.translations objects together? Or is that
insane?

What's the best way to handle a project with multiple domain.mo files?

I hope someone can give me some advice.

\d




More information about the Python-list mailing list