i18n: Add makefile to handle translation updates
This commit is contained in:
parent
d708afdc1c
commit
71f18fdaae
20
tools/translations/Makefile
Normal file
20
tools/translations/Makefile
Normal 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
|
|
@ -107,5 +107,5 @@ shutil.move("tools.pot", "tools/translations/tools.pot")
|
||||||
if (os.name == "posix"):
|
if (os.name == "posix"):
|
||||||
added = subprocess.check_output("git diff tools/translations/tools.pot | grep \+msgid | wc -l", shell = True)
|
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)
|
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("\n# Template changes compared to the staged status:")
|
||||||
print(" Additions: %s msgids.\n Deletions: %s msgids." % (int(added), int(removed)))
|
print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed)))
|
||||||
|
|
Loading…
Reference in a new issue