Mercurial > hg-stable
changeset 7710:88326ee85a1b
i18n: extract strings with xgettext
The xgettext program knows about Python string formatting and will
mark messages with a special "#, python-format" comment in the hg.pot
file. When msgfmt compiles the file, it can check these messages to
ensure that the translated string uses the same conversion specifiers
as the original string.
The pygettext program is still used to extract the docstrings.
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Sun, 25 Jan 2009 21:31:54 +0100 |
parents | 752325f2208d |
children | a0de99db7cdc |
files | Makefile |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sun Jan 25 12:09:51 2009 -0600 +++ b/Makefile Sun Jan 25 21:31:54 2009 +0100 @@ -77,11 +77,17 @@ update-pot: mkdir -p i18n - pygettext -d doc -p i18n --docstrings \ - mercurial/commands.py hgext/*.py hgext/*/__init__.py - pygettext -d all -p i18n mercurial hgext doc - msgcat --sort-by-file i18n/doc.pot i18n/all.pot > i18n/hg.pot - rm i18n/doc.pot i18n/all.pot + pygettext -d hg -p i18n --docstrings \ + mercurial/commands.py hgext/*.py hgext/*/__init__.py + # All strings marked for translation in Mercurial contain + # ASCII characters only. But some files contain string + # literals like this '\037\213'. xgettext thinks it has to + # parse these them even though they are not marked for + # translation. Extracting with an explicit encoding of + # ISO-8859-1 will make xgettext "parse" and ignore them. + find mercurial hgext doc -name '*.py' | xargs \ + xgettext --from-code ISO-8859-1 --join --sort-by-file \ + -d hg -p i18n -o hg.pot .PHONY: help all local build doc clean install install-bin install-doc \ install-home install-home-bin install-home-doc dist dist-notests tests \