Browse Source

i18n: Add makefile to handle translation updates

Rémi Verschelde 9 years ago
parent
commit
71f18fdaae
2 changed files with 22 additions and 2 deletions
  1. 20 0
      tools/translations/Makefile
  2. 2 2
      tools/translations/extract.py

+ 20 - 0
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

+ 2 - 2
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)))