1 # Extract translatable strings from Roundup sources,
2 # update and compile all existing translations
3 #
4 # $Id: GNUmakefile,v 1.11 2006-11-16 14:14:42 a1s Exp $
6 # tool locations
7 XPOT ?= xpot
8 MSGFMT ?= msgfmt
9 MSGMERGE ?= msgmerge
10 XGETTEXT ?= xgettext
11 PYTHON ?= python
13 TEMPLATE=roundup.pot
15 PACKAGES=$(shell find ../roundup ../share/roundup/templates -name '*.py' \
16 | sed -e 's,/[^/]*$$,,' | sort | uniq)
17 SOURCES=$(PACKAGES:=/*.py)
18 PO_FILES=$(wildcard *.po)
19 MO_FILES=$(PO_FILES:.po=.mo)
20 RUN_PYTHON=PYTHONPATH=../build/lib $(PYTHON) -O
22 all: dist
24 help:
25 @echo "$(MAKE) - build MO files. Run this before sdist"
26 @echo "$(MAKE) template - update message template from sources"
27 @echo "$(MAKE) locale.po - update message file from template"
28 @echo "$(MAKE) locale.mo - compile individual message file"
29 @echo "$(MAKE) help - this text"\
31 # This will rebuild all MO files without updating their corresponding PO
32 # files first. Run before creating Roundup distribution (hence the name).
33 # PO files should be updated by their translators only, automatic update
34 # adds unwanted fuzzy labels.
35 dist:
36 for file in $(PO_FILES); do \
37 ${MSGFMT} -o `basename $$file .po`.mo $$file; \
38 done
40 template:
41 ${XPOT} -n -o $(TEMPLATE) $(SOURCES)
42 ${RUN_PYTHON} ../roundup/cgi/TAL/talgettext.py -u $(TEMPLATE) \
43 ../share/roundup/templates/classic/html/*.html \
44 ../share/roundup/templates/minimal/html/*.html
45 ${XGETTEXT} -j -w 80 -F \
46 --msgid-bugs-address=roundup-devel@lists.sourceforge.net \
47 --copyright-holder="See Roundup README.txt" \
48 -o $(TEMPLATE) $(SOURCES)
50 # helps to check template file before check in
51 diff:
52 svn diff roundup.pot|grep -v '^[-+]#'|vim -Rv -
54 %.po: $(TEMPLATE)
55 ${MSGMERGE} -U --suffix=.bak $@ $<
57 %.mo: %.po
58 ${MSGFMT} --statistics -o $@ $<