annotate locale/Makefile @ 8489:4e0944649af7

chore: update actions/checkout from 6.0.0 to 6.1.1 pull74
author John Rouillard <rouilj@ieee.org>
date Mon, 08 Dec 2025 23:07:57 -0500
parents 8824c81cc431
children
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)
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
16 TEMPLATES=$(wildcard ../share/roundup/templates/*/html/*.html)
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
17 PO_FILES=$(wildcard *.po)
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
18 MO_FILES=$(PO_FILES:.po=.mo)
7419
dce8f7799ecb locale's 'make template' now works without having to do a build first.
John Rouillard <rouilj@ieee.org>
parents: 7402
diff changeset
19 RUN_PYTHON=PYTHONPATH=.. $(PYTHON) -O
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
20
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
21 ##@ default target
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
22 all: dist ## build MO files. Run this before sdist"
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
23
2455
ece6ed48dd3d by default, build binary message catalogs only...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2384
diff changeset
24 # 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
25 # 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
26 # 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
27 # adds unwanted fuzzy labels.
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
28 dist: $(MO_FILES) ## same as all target
2306
1421b19cd61b build message template file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
diff changeset
29
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
30 ##@ Update files
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
31 template: roundup.pot ## extract messages from source into template
7422
7d1df030b22f Add merge action; make template depend on source files
John Rouillard <rouilj@ieee.org>
parents: 7421
diff changeset
32
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
33 merge: $(PO_FILES) ## merge template updates into *.po files
7422
7d1df030b22f Add merge action; make template depend on source files
John Rouillard <rouilj@ieee.org>
parents: 7421
diff changeset
34
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
35 # do the template file update
7422
7d1df030b22f Add merge action; make template depend on source files
John Rouillard <rouilj@ieee.org>
parents: 7421
diff changeset
36 roundup.pot: $(SOURCES) $(TEMPLATES)
7420
eef12ab01f51 filter output of xpot. decorators not recognized
John Rouillard <rouilj@ieee.org>
parents: 7419
diff changeset
37 ${XPOT} -n -o $(TEMPLATE) $(SOURCES) 2>&1 | sed -e "/: Unexpected in Python source: #64 \`@'/d"
6222
2c0f7f16ce04 Check that build link is present otherwise abort.
John Rouillard <rouilj@ieee.org>
parents: 4570
diff changeset
38
2459
fd04f41ab988 fix: 'template' target was meant to make 'roundup.pot' file
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2455
diff changeset
39 ${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
40 ../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
41 ../share/roundup/templates/devel/html/*.html \
a21b574554c3 extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents: 6222
diff changeset
42 ../share/roundup/templates/minimal/html/*.html \
a21b574554c3 extract translatable strings from devel and responsive templates
John Rouillard <rouilj@ieee.org>
parents: 6222
diff changeset
43 ../share/roundup/templates/responsive/html/*.html
7792
ed0fce27fd75 build: replace verstion extraction via set to use python
John Rouillard <rouilj@ieee.org>
parents: 7424
diff changeset
44 VERSION="`${RUN_PYTHON} -c 'from roundup import __version__; \
ed0fce27fd75 build: replace verstion extraction via set to use python
John Rouillard <rouilj@ieee.org>
parents: 7424
diff changeset
45 print(__version__)';`"; \
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
46 ${XGETTEXT} -j -w 80 -F \
7797
8bdf0484215c Summary: feat: roundup-admin history command has human interpretable output
John Rouillard <rouilj@ieee.org>
parents: 7792
diff changeset
47 --add-comments=".Hint " \
6672
01216187a167 Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents: 6618
diff changeset
48 --package-name=Roundup \
01216187a167 Testing translations in mailgw.py, update translations, i18n improved
John Rouillard <rouilj@ieee.org>
parents: 6618
diff changeset
49 --package-version=$$VERSION \
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
50 --msgid-bugs-address=roundup-devel@lists.sourceforge.net \
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
51 --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
52 -o $(TEMPLATE) $(SOURCES)
2330
8ae58eda9331 in addition to xpot...
Alexander Smishlajev <a1s@users.sourceforge.net>
parents: 2306
diff changeset
53
8271
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
54 ## QA commands
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
55 diff: ## see template file (roundup.pot) differences
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
56 hg cat roundup.pot | diff -u -I '^\#: \.\./roundup.*$$' \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
57 -I '^#:\s*:[0-9]*.*$$' \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
58 - roundup.pot || exit 0
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
59
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
60 potest: ## check .po files for errors
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
61 sh -c 'for file in $(PO_FILES); do \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
62 ${MSGFMT} -cv --statistics $$file; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
63 done' 2>&1 | sort -k 2,2n
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
64
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
65
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
66 ##@ Testing
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
67 pytest: local_install ## create locale files to run pytest
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
68 local_install:
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
69 for file in $(PO_FILES); do \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
70 ${MSGFMT} -o `basename $$file .po`.mo $$file; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
71 done
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
72 for file in $(MO_FILES); do \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
73 lang=`basename $$file .mo`; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
74 mkdir -p locale/$$lang/LC_MESSAGES; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
75 cp $$file locale/$$lang/LC_MESSAGES/roundup.mo; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
76 done
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
77
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
78 ### template rules
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
79 %.po: $(TEMPLATE)
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
80 @echo "Rebuild $@"
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
81 @${MSGMERGE} -U --suffix=.bak $@ $<
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
82 @# update Project-Id-Version to match roundup.pot
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
83 @VER="`sed -ne \"/__version__/s/.*'\(.*\)'.*/\1/p\" \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
84 ../roundup/__init__.py`"; \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
85 sed -i -e \
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
86 "s/^\(\"Project-Id-Version: Roundup\).*/\1 $${VER}\\\\n\"/" $@
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
87
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
88 %.mo: %.po
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
89 ${MSGFMT} -o $@ $<
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
90
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
91 # from https://www.thapaliya.com/en/writings/well-documented-makefiles/ via
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
92 # https://til.jakelazaroff.com/make/list-all-commands-in-a-makefile/
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
93 help: ## this text
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
94 @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[.a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
95
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
96 @echo ""
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
97 @printf " \033[36m%-15s\033[0m %s\n" "<locale>.po" "update message file from template"
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
98 @printf " \033[36m%-15s\033[0m %s\n" "<locale>.mo" "compile individual message file"
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
99 @echo ""
8824c81cc431 doc: add make help to all Makefiles and fix 2 Makefiles
John Rouillard <rouilj@ieee.org>
parents: 7797
diff changeset
100 @echo "Running 'make' is the same as: make template merge dist"

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