[PATCH] enhance Makefile for language translators
Tobias Bell
tobias.bell at googlemail.com
Thu Mar 26 02:07:42 CDT 2009
# HG changeset patch
# User Tobias Bell <tobias.bell at gmail.com>
# Date 1238051248 -3600
# Node ID c4897c765dd26754e781edcec8e41a726cb0a002
# Parent c2ecaf63badee4e973c4d843121139d4d3269f12
enhance Makefile for language translators
To update a po-file just do 'make i18n/xx.po'. No other po-file will
be touched.
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@
export PREFIX
PYTHON=python
PURE=
+PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py')
+PO_FILES:=$(wildcard i18n/*.po)
help:
@echo 'Commonly used make targets:'
@@ -76,7 +78,9 @@
test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
-update-pot:
+update-pot: i18n/hg.pot
+
+i18n/hg.pot: $(PYTHON_FILES)
mkdir -p i18n
pygettext -d hg -p i18n --docstrings \
mercurial/commands.py hgext/*.py hgext/*/__init__.py
@@ -86,10 +90,14 @@
# 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 \
+ echo $^ | xargs \
xgettext --from-code ISO-8859-1 --join --sort-by-file \
-d hg -p i18n -o hg.pot
+%.po: i18n/hg.pot
+ msgmerge -U $@ $^
+
.PHONY: help all local build doc clean install install-bin install-doc \
install-home install-home-bin install-home-doc dist dist-notests tests \
- update-pot
+ update-pot update-po
+
More information about the Mercurial-devel
mailing list