Skip to content
Snippets Groups Projects
Commit 88326ee8 authored by Martin Geisler's avatar Martin Geisler
Browse files

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.
parent 752325f2
No related merge requests found
......@@ -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 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment