[PATCH 6 of 6] let Makefile generate hg.pot and xx.mo files
Martin Geisler
mg at daimi.au.dk
Fri Sep 5 23:11:22 UTC 2008
# HG changeset patch
# User Martin Geisler <mg at daimi.au.dk>
# Date 1220655371 -7200
# Node ID 5083fd1874df84988a1421ccc44ac7e57c9dc1a0
# Parent 9d15008f375612a6bc3dfaf509cb68bdb704856a
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.
The MANIFEST target now also depend on update-mo and includes the
hg.mo files.
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -27,6 +27,7 @@
.DS_Store
tags
cscope.*
+locale/*/LC_MESSAGES/hg.mo
syntax: regexp
^\.pc/
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -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'
@@ -58,10 +60,11 @@
MANIFEST-doc:
$(MAKE) -C doc MANIFEST
-MANIFEST: MANIFEST-doc
+MANIFEST: MANIFEST-doc update-mo
hg manifest > MANIFEST
echo mercurial/__version__.py >> MANIFEST
cat doc/MANIFEST >> MANIFEST
+ for f in locale/*/LC_MESSAGES/hg.mo; do echo "$$f" >> MANIFEST; done
dist: tests dist-notests
@@ -74,6 +77,19 @@
test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
+update-pot:
+ pygettext.py -d doc -p po --docstrings \
+ mercurial/commands.py hgext/*.py hgext/*/__init__.py
+ pygettext.py -d all -p po mercurial hgext doc
+ msgcat po/doc.pot po/all.pot > po/hg.pot
+ rm po/doc.pot po/all.pot
+
+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