Mercurial > p > roundup > code
annotate locale/GNUmakefile @ 6672:01216187a167
Testing translations in mailgw.py, update translations, i18n improved
i18n.py: translation objects get a _file which is the file that catalog
was loaded from. Useful for debugging.
mailgw.py: fix code to include roundup.i18n and invoke propert method.
GNUMakefile: added roundup.pot target. Also building roundup.pot sets
the release version and product code in roundup.pot.
Release version from roundup.__init__.py.
merged roundup.pot changes into all *.po files. Not sure if the
version info in the headers of the .po files is supposed to be
updated to match roundup.pot or not.
test_mailgw.py: test cases for en and de translations tested. Not sure
why I neede to set roundupdb._ and mailgw._, but followed setUp
method code and it worked.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 11 May 2022 21:20:34 -0400 |
| parents | ebd8f962fbf1 |
| children | 4b6a6b794dfa |
| 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" |
|
6618
ebd8f962fbf1
Fix make help. Missing close quotes.
John Rouillard <rouilj@ieee.org>
parents:
6609
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" |
|
6618
ebd8f962fbf1
Fix make help. Missing close quotes.
John Rouillard <rouilj@ieee.org>
parents:
6609
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" |
|
6618
ebd8f962fbf1
Fix make help. Missing close quotes.
John Rouillard <rouilj@ieee.org>
parents:
6609
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 |
|
6672
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
51 VERSION="`sed -ne \"/__version__/s/.*'\(.*\)'.*/\1/p\" \ |
|
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
52 ../build/lib/roundup/__init__.py`"; \ |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
53 ${XGETTEXT} -j -w 80 -F \ |
|
6672
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
54 --package-name=Roundup \ |
|
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
55 --package-version=$$VERSION \ |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
56 --msgid-bugs-address=roundup-devel@lists.sourceforge.net \ |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
57 --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
|
58 -o $(TEMPLATE) $(SOURCES) |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
59 |
|
6609
b6452b669720
Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents:
6483
diff
changeset
|
60 pytest local_install: dist |
| 6480 | 61 for file in $(MO_FILES); do \ |
|
6483
9730eff21de3
Remove verbose from local_install. Cleanup log.
John Rouillard <rouilj@ieee.org>
parents:
6480
diff
changeset
|
62 lang=`basename $$file .mo`; \ |
| 6480 | 63 mkdir -p locale/$$lang/LC_MESSAGES; \ |
| 64 cp $$file locale/$$lang/LC_MESSAGES/roundup.mo; \ | |
| 65 done | |
| 66 | |
|
3578
782287e01b99
added template diff target: view changes in message strings
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2459
diff
changeset
|
67 # 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
|
68 diff: |
|
6609
b6452b669720
Updates, python3, hg diff, add target doc, add pytest target
John Rouillard <rouilj@ieee.org>
parents:
6483
diff
changeset
|
69 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
|
70 |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
71 %.po: $(TEMPLATE) |
|
3593
3d9e1906ba58
don't wrap po files at position 72
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3578
diff
changeset
|
72 ${MSGMERGE} -U --suffix=.bak $@ $< |
|
2330
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
73 |
|
8ae58eda9331
in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2306
diff
changeset
|
74 %.mo: %.po |
|
2342
106737dbe689
show statistics for message catalogs
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
2330
diff
changeset
|
75 ${MSGFMT} --statistics -o $@ $< |
|
6672
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
76 |
|
01216187a167
Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents:
6618
diff
changeset
|
77 roundup.pot: template |
