From 71f18fdaae156eabd5a35749626bec0f8f33718d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 28 May 2016 13:00:57 +0200 Subject: i18n: Add makefile to handle translation updates --- tools/translations/Makefile | 20 ++++++++++++++++++++ tools/translations/extract.py | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tools/translations/Makefile (limited to 'tools') 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))) -- cgit v1.2.3