annotate locale/GNUmakefile @ 6609:b6452b669720

Updates, python3, hg diff, add target doc, add pytest target
author John Rouillard <rouilj@ieee.org>
date Fri, 28 Jan 2022 20:11:32 -0500
parents 9730eff21de3
children ebd8f962fbf1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
1 # Extract translatable strings from Roundup sources,
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
2 # update and compile all existing translations
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
3
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
4 # tool locations
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
5 XPOT ?= xpot
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
6 MSGFMT ?= msgfmt
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
7 MSGMERGE ?= msgmerge
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
8 XGETTEXT ?= xgettext
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
9 PYTHON ?= python3
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
10
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
11 TEMPLATE=roundup.pot
2306
1421b19cd61b build message template file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
diff changeset
12
4094
5a9631828e33 update message template file building:
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 3761
diff changeset
13 PACKAGES=$(shell find ../roundup ../share/roundup/templates -name '*.py' \
3761
800bc51a9c8e add template directories to the list of Python packages for message extraction
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 3593
diff changeset
14 | sed -e 's,/[^/]*$$,,' | sort | uniq)
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
15 SOURCES=$(PACKAGES:=/*.py)
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
16 PO_FILES=$(wildcard *.po)
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
17 MO_FILES=$(PO_FILES:.po=.mo)
6222
2c0f7f16ce04 Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents: 4570
diff changeset
18 PYTHON_BUILD=../build/lib
2c0f7f16ce04 Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents: 4570
diff changeset
19 RUN_PYTHON=PYTHONPATH=$(PYTHON_BUILD) $(PYTHON) -O
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
20
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
21 all: dist
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
22
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
23 help:
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
24 @echo "$(MAKE) - build MO files. Run this before sdist"
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
25 @echo "$(MAKE) dist - same as above
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
26 @echo "$(MAKE) template - update message template from sources"
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
27 @echo "$(MAKE) diff - see template differences in vi"
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
28 @echo "$(MAKE) pytest - create locale files to run pytest
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
29 @echo "$(MAKE) locale.po - update message file from template"
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
30 @echo "$(MAKE) locale.mo - compile individual message file"
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
31 @echo "$(MAKE) help - this text"\
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
32
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
33 # This will rebuild all MO files without updating their corresponding PO
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
34 # files first. Run before creating Roundup distribution (hence the name).
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
35 # PO files should be updated by their translators only, automatic update
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
36 # adds unwanted fuzzy labels.
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
37 dist:
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
38 for file in $(PO_FILES); do \
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
39 ${MSGFMT} -o `basename $$file .po`.mo $$file; \
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
40 done
2306
1421b19cd61b build message template file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
diff changeset
41
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
42 template:
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
43 test -d $(PYTHON_BUILD) || (echo "Missing build directory $(PYTHON_BUILD). ln -s lib to build library"; exit 1)
2459
fd04f41ab988 fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2455
diff changeset
44 ${XPOT} -n -o $(TEMPLATE) $(SOURCES)
6222
2c0f7f16ce04 Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents: 4570
diff changeset
45
2459
fd04f41ab988 fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2455
diff changeset
46 ${RUN_PYTHON} ../roundup/cgi/TAL/talgettext.py -u $(TEMPLATE) \
4094
5a9631828e33 update message template file building:
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 3761
diff changeset
47 ../share/roundup/templates/classic/html/*.html \
6405
a21b574554c3 extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents: 6222
diff changeset
48 ../share/roundup/templates/devel/html/*.html \
a21b574554c3 extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents: 6222
diff changeset
49 ../share/roundup/templates/minimal/html/*.html \
a21b574554c3 extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents: 6222
diff changeset
50 ../share/roundup/templates/responsive/html/*.html
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
51 ${XGETTEXT} -j -w 80 -F \
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
52 --msgid-bugs-address=roundup-devel@lists.sourceforge.net \
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
53 --copyright-holder="See Roundup README.txt" \
2459
fd04f41ab988 fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2455
diff changeset
54 -o $(TEMPLATE) $(SOURCES)
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
55
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
56 pytest local_install: dist
6480
0f0cee081990 Force test of a locale
John Rouillard <rouilj@ieee.org>
parents: 6405
diff changeset
57 for file in $(MO_FILES); do \
6483
9730eff21de3 Remove verbose from local_install. Cleanup log.
John Rouillard <rouilj@ieee.org>
parents: 6480
diff changeset
58 lang=`basename $$file .mo`; \
6480
0f0cee081990 Force test of a locale
John Rouillard <rouilj@ieee.org>
parents: 6405
diff changeset
59 mkdir -p locale/$$lang/LC_MESSAGES; \
0f0cee081990 Force test of a locale
John Rouillard <rouilj@ieee.org>
parents: 6405
diff changeset
60 cp $$file locale/$$lang/LC_MESSAGES/roundup.mo; \
0f0cee081990 Force test of a locale
John Rouillard <rouilj@ieee.org>
parents: 6405
diff changeset
61 done
0f0cee081990 Force test of a locale
John Rouillard <rouilj@ieee.org>
parents: 6405
diff changeset
62
3578
782287e01b99 added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2459
diff changeset
63 # helps to check template file before check in
782287e01b99 added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2459
diff changeset
64 diff:
6609
b6452b669720 Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents: 6483
diff changeset
65 hg diff roundup.pot|grep -v '^[-+]#'| vi -Rv -
3578
782287e01b99 added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2459
diff changeset
66
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
67 %.po: $(TEMPLATE)
3593
3d9e1906ba58 don't wrap po files at position 72
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 3578
diff changeset
68 ${MSGMERGE} -U --suffix=.bak $@ $<
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
69
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
70 %.mo: %.po
2342
106737dbe689 show statistics for message catalogs
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2330
diff changeset
71 ${MSGFMT} --statistics -o $@ $<

Roundup Issue Tracker: http://roundup-tracker.org/