summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-06-01 07:51:32 -0500
committerJeff Epler <jepler@gmail.com>2020-06-01 07:51:57 -0500
commit79e2ede7c1f4c712ba159400e10282c8f28fb033 (patch)
treec8f5d738307c55a444f01c8bd1cf587b90921f5d /Makefile
parent47efd595fce11240f92efecf768800e8d81fa702 (diff)
Makefile: "make translate" will only update circuitpython.pot
We can now rely on weblate to regularly update the individual language files from the template, so "make translate" only needs to update the template file circuitpython.pot. This is advantageous because updating the other files in locale/ was a frequent source of merge conflicts; resolving the conflict incorrectly was something that could easily occur (and did).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 17 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f6146bfe4..55f64b17d 100644
--- a/Makefile
+++ b/Makefile
@@ -202,12 +202,25 @@ pseudoxml:
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
# phony target so we always run
+.PHONY: all-source
all-source:
locale/circuitpython.pot: all-source
find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
+# Historically, `make translate` updated the .pot file and ran msgmerge.
+# However, this was a frequent source of merge conflicts. Weblate can perform
+# msgmerge, so make translate merely update the translation template file.
+.PHONY: translate
translate: locale/circuitpython.pot
+
+# Note that normally we rely on weblate to perform msgmerge. This reduces the
+# chance of a merge conflict between developer changes (that only add and
+# remove source strings) and weblate changes (that only add and remove
+# translated strings from po files). However, in case this is legitimately
+# needed we preserve a rule to do it.
+.PHONY: msgmerge
+msgmerge:
for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done
merge-translate:
@@ -216,8 +229,10 @@ merge-translate:
git checkout --theirs -- locale/*
make translate
-check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
- $(PYTHON) tools/check_translations.py $^
+.PHONY: check-translate
+check-translate:
+ find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot.tmp -p locale
+ $(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status
stubs:
@mkdir -p circuitpython-stubs