[RFC] Bazaar internationalization (i18n)
Alexander Belchenko
bialix at ukr.net
Wed Apr 25 03:44:45 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Now more about code.
Although loading and installing localized messages at the start of program
seems reasonable in wide sense, it's bad for us, because it leads bzr
to 2 problems:
1) selftesting
2) general usage and redirected stdout/stderr
In details:
1) Our selftest subsytem (especially blackbox tests) heavily rely on hardcoded
english messages for expected output. Running bzr with translated
interface turn selftest into mess. So I suppose we don't want to run
selftest with localized messages by default. At least *I* personally
hate the thoughts that I need every time before selftest manually
$ set LANG=C
2) You are using unicode interface of gettext, i.e. localized messages
will become unicode strings in runtime. It's the right thing.
But it has one important side effect: when you try to print
unicode string to stdout that redirected to pipe or another file,
you'll get UnicodeEncodeError at runtime. I.e. try to run
your code as
$ python -OO bzr | less
and you'll see traceback.
Safe solution is loading and enabling localized messages after we properly
set up stdout and stderr. Currently we use such set up in Commands._setup_outf().
Probably some errors should also activate similar setup for stderr before
print localized messages.
And this means that some error messages (especially from bzr script itself)
should remains untranslated.
And of course we should finally fix this long
standing bug: https://bugs.launchpad.net/bzr/+bug/54173
Richard Wilbur still don't finish his fix, so I'll fix it myself.
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGLsCdzYr338mxwCURApQeAJ9/XV0li2Y2aWzWYYmdw5c3eZfyhgCghyxW
eT089QhvRRim9B/W2Y+ieWY=
=3giK
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list