[PATCH 0 of 5] i18n patches
Martin Geisler
mg at daimi.au.dk
Sat Jan 10 00:26:40 UTC 2009
Hi everybody,
Another go of the i18n-patches :-)
* Patch 1 makes it easier to find the hg.mo files. The gettext module
would lookup the hg.mo file corresponding to xx.po in
/usr/share/locale/xx/LC_MESSAGES/hg.mo
But that makes it annoying to test new translations and difficult
for people who does not install to that location. So I changed
i18n.py to use a path of . or .., relative to the location of
i18n.py. This is the same way templater.py uses to find the
templates directory.
* Patch 2 ensures that the output is encoded in the user's local
encoding (as given by HGENCODING, LANG, LC_ALL, ...).
With this patch the output of the Danish translation changes back
and forth like this (my terminal is set to ISO-8859-1):
% LANG=da_DK.ISO-8859-1 hg log -l 1
ændring: 7053:3d8f300b3a38
mærkat: i18n-test-da
mærkat: qtip
mærkat: tip
bruger: Martin Geisler <mg at daimi.au.dk>
dato: Tue Sep 23 23:22:26 2008 +0200
uddrag: i18n: test case for Danish translation
% LANG=da_DK.UTF-8 hg log -l 1
ændring: 7053:3d8f300b3a38
mærkat: i18n-test-da
mærkat: qtip
mærkat: tip
bruger: Martin Geisler <mg at daimi.au.dk>
dato: Tue Sep 23 23:22:26 2008 +0200
uddrag: i18n: test case for Danish translation
% LANG=da_DK.bogus hg log -l 1
?ndring: 7053:3d8f300b3a38
m?rkat: i18n-test-da
m?rkat: qtip
m?rkat: tip
bruger: Martin Geisler <mg at daimi.au.dk>
dato: Tue Sep 23 23:22:26 2008 +0200
uddrag: i18n: test case for Danish translation
I believe this is the correct output: the first case works fine, the
second gives UTF-8 encoded output in my Latin-1 terminal, and the
third gives Danish text, but with 'æ' replaced by '?' since the
bogus encoding cannot be found, making hg fallback to 'ascii'.
* Patch 3 adds new targets to the Makefile for updating the hg.pot (PO
template) file and to generate xx.mo files. I've added these files
to the .hgignore file.
* Patch 4 adds a rough Danish translation.
* Patch 5 adds a test case. One *must* run 'make update-mo' after
applying this patch, otherwise the test case will fail. The problem
is that run-tests.py use the setup.py script to install, and that
script does not know anything about generating the .mo files.
I could go in and hack run-tests.py and make it run the Makefile.
That would add 'make' and 'msgfmt' to the required_tools in
run-tests.py, maybe making it even harder to port the tests.
I could also skip the test if no translation is found.
I maintain a patch queue here from which you can do a qclone:
http://www.bitbucket.org/mg/hg-i18n-patches/
If you want to begin experimenting with translating Mercurial, then
please see the guide I posted here:
http://selenic.com/pipermail/mercurial-devel/2008-September/007789.html
More information about the Mercurial-devel
mailing list