summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-05-28 13:00:57 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-05-28 13:00:57 +0200
commit71f18fdaae156eabd5a35749626bec0f8f33718d (patch)
tree4940d1eb759aa5c24e27c476b5b4ff2a11687a40
parentd708afdc1cd0c23ee3381bd91fe20a7c2acfd056 (diff)
i18n: Add makefile to handle translation updates
-rw-r--r--tools/translations/Makefile20
-rwxr-xr-xtools/translations/extract.py4
2 files changed, 22 insertions, 2 deletions
diff --git a/tools/translations/Makefile b/tools/translations/Makefile
new file mode 100644
index 0000000000..30b0832783
--- /dev/null
+++ b/tools/translations/Makefile
@@ -0,0 +1,20 @@
+# Makefile providing various facilities to manage translations
+
+TEMPLATE = tools.pot
+POFILES = $(wildcard *.po)
+LANGS = $(POFILES:%.po=%)
+
+all: update merge
+
+update:
+ @cd ../..; python tools/translations/extract.py
+
+merge:
+ @for po in $(POFILES); do \
+ echo -e "\nMerging $$po..."; \
+ msgmerge -w 80 -C $$po $$po $(TEMPLATE) > "$$po".new; \
+ mv -f "$$po".new $$po; \
+ done
+
+check:
+ @for po in $(POFILES); do msgfmt -c $$po -o /dev/null; done
diff --git a/tools/translations/extract.py b/tools/translations/extract.py
index 195f45f637..ef3ad4da65 100755
--- a/tools/translations/extract.py
+++ b/tools/translations/extract.py
@@ -107,5 +107,5 @@ shutil.move("tools.pot", "tools/translations/tools.pot")
if (os.name == "posix"):
added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell = True)
removed = subprocess.check_output("git diff tools/translations/tools.pot | grep \\\-msgid | wc -l", shell = True)
- print("Template changes compared to the staged status:")
- print(" Additions: %s msgids.\n Deletions: %s msgids." % (int(added), int(removed)))
+ print("\n# Template changes compared to the staged status:")
+ print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed)))