[Freeipa-devel] [PATCH] Use pygettext to generate translatable strings from plugin files.
Pavel Zůna
pzuna at redhat.com
Mon Feb 21 15:12:31 UTC 2011
This goes on top of my other localization patches!
This patch replaces xgettext with a custom pygettext to generate
translatable strings from plugin files in ipalib/plugins. pygettext was
modified to handle plural forms (credit goes to Jan Hendrik Goellner)
and had some bugs fixed by myself. We only use it for plugins, because
it's the only place where we need to extract docstrings for the built-in
help system.
I also had to make some changes to the way the built-in documentation
system gets docstrings from modules for this to work.
How to test?
============
1)
First, apply all of the localization patches found in thread
"Localization patches" on freeipa-devel. Then apply this patch.
2)
Regenerate your install/po/Makefile:
- delete install/po/Makefile
- run `./configure` in install
3)
Regenerate the pot and po files:
- run `make update-pot` in install/po
- run `make update-po` in install/po
4)
Make a change to one of the translations:
- example: add translation to the ACI docstring
* find docstring for ACI in install/po/es.po
* change the corresponding msgstr "" to
msgstr "\nBuenos dias, amigos!\n"
Note: if the translatable string begins with \n, the translation also
needs to begin with \n. Same goes for ending.
5)
Install the modified translations:
- run `make install` in install/po
Note: I had some problems with this and had to make rpms and install IPA
from beginning for it to work. Looks like doing `make install` manually
updates /usr/local/share/locale instead of /usr/share/locale, but maybe
I just did something wrong.
6)
Set language to Spanish or whatever translation you modified:
- example:
* # LANG="es_ES.utf8"
# export LANG
7)
Display the translated documentation:
- example:
* # ipa help aci
Buenos dias, amigos!
Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-pzuna-83-pygettext.patch
Type: application/mbox
Size: 35344 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20110221/9885aa6b/attachment.mbox>
More information about the Freeipa-devel
mailing list