i18n: Add makefile to handle translation updates

This commit is contained in:
Rémi Verschelde 2016-05-28 13:00:57 +02:00
parent d708afdc1c
commit 71f18fdaae
2 changed files with 22 additions and 2 deletions

View file

@ -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

View file

@ -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)))