[RFC] Bazaar internationalization (i18n)
Alexander Belchenko
bialix at ukr.net
Tue Apr 24 16:07:45 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tobias Toedter пишет:
> Hi,
>
> I've started to add internationalization capabilities to bzr. Please take a
> look at the blueprint here:
> <https://blueprints.launchpad.net/bzr/+spec/i18n>
>
> You'll find the branch associated with the blueprint.
I think that blueprints means writing specification before code.
Am I wrong?
> If the general implementation seems correct to you, I could start to make
> all translatable program messages use the gettext() resp. _() function.
I don't see too much code in your branch, but it seems correct in general
and incorrect in details.
But I think it's more important to discuss policy rather than code.
1) In my bzr-config utility[1] I use this approach:
in the root of my tree I have these directories:
/po -- directory with pot file and translations files
/locale -- directory with compiled mo files, i.e.
/locale/ru/LC_MESSGES/bzrconfig.mo -- it's ready to use Russian translation
I found this approach useful because it allows me to easily test my translations
and run my utility with translated interface from sources.
3) Although I try to setup Rosetta for my utility -- I'm still don't understand
how it supposed to work, and how it helps me if I'm working not on Ubuntu.
If my approach is make sense for bzr.dev I will talk about code organization
and win32-compatibility of gettext.
Now just one note about your code:
try:
import gettext
gettext.install('bzr', unicode=1)
except ImportError:
# if anything went wrong, provide a generic function
def _(msgid):
return msgid
Your exception handler is not enough in the sense of bzr.dev,
because you should install _() function in builtins dict.
In your code this function will exists only for bzr script,
but not for the rest of bzrlib. See sources of gettext module
from standard library for install method.
[1] https://launchpad.net/bzr-config
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGLh1BzYr338mxwCURAhEOAJ0WU/QcZibd3V4mkxrESjxo8y4TLgCeJLkU
lT7bcGAjwbReB4TxjOFhlXw=
=0pnL
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list