[PATCH 4 of 4] let Makefile generate hg.pot and xx.mo files

Martin Geisler mg at daimi.au.dk
Fri Aug 22 15:51:17 CDT 2008


# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1219437406 -7200
# Node ID 9039d2ba96fa1dc2c0e0130f18cbd2541c05302c
# Parent  a620e5e08782460b488ff15d11a614482050e262
let Makefile generate hg.pot and xx.mo files

The target update-pot runs extracts strings using pygettext.py and
updates po/hg.pot. The translators can then use msgmerge to merge the
new strings in hg.pot with their xx.po file when they want to.

The update-mo target generates a locale/xx/LC_MESSAGES/hg.mo file for
each po/xx.po file present.

diff -r a620e5e08782 -r 9039d2ba96fa .hgignore
--- a/.hgignore	Fri Aug 22 22:34:06 2008 +0200
+++ b/.hgignore	Fri Aug 22 22:36:46 2008 +0200
@@ -27,6 +27,7 @@
 .DS_Store
 tags
 cscope.*
+locale/*/LC_MESSAGES/hg.mo
 
 syntax: regexp
 ^\.pc/
diff -r a620e5e08782 -r 9039d2ba96fa Makefile
--- a/Makefile	Fri Aug 22 22:34:06 2008 +0200
+++ b/Makefile	Fri Aug 22 22:36:46 2008 +0200
@@ -13,6 +13,8 @@
 	@echo '  dist         - run all tests and create a source tarball in dist/'
 	@echo '  clean        - remove files created by other targets'
 	@echo '                 (except installed files or dist source tarball)'
+	@echo '  update-pot   - update hg.pot template in po/'
+	@echo '  update-mo    - generate .mo files in locale/'
 	@echo
 	@echo 'Example for a system-wide installation under /usr/local:'
 	@echo '  make all && su -c "make install" && hg version'
@@ -74,6 +76,15 @@
 test-%:
 	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
 
+update-pot:
+	pygettext.py -a -d hg -p po mercurial hgext
+
+locale/%/LC_MESSAGES/hg.mo: po/%.po
+	mkdir -p $(dir $@)
+	msgfmt.py -o $@ $<
+
+update-mo: $(patsubst po/%.po, locale/%/LC_MESSAGES/hg.mo, $(wildcard po/*.po))
 
 .PHONY: help all local build doc clean install install-bin install-doc \
-	install-home install-home-bin install-home-doc dist dist-notests tests
+	install-home install-home-bin install-home-doc dist dist-notests tests \
+	update-pot update-mo


More information about the Mercurial-devel mailing list