i18n: Adapt script to tools/editor -> editor move

This commit is contained in:
Rémi Verschelde 2017-03-24 22:24:08 +01:00
parent a531051a61
commit d2e8a21cb1
3 changed files with 10 additions and 10 deletions

View file

@ -1,13 +1,13 @@
# Makefile providing various facilities to manage translations # Makefile providing various facilities to manage translations
TEMPLATE = tools.pot TEMPLATE = editor.pot
POFILES = $(wildcard *.po) POFILES = $(wildcard *.po)
LANGS = $(POFILES:%.po=%) LANGS = $(POFILES:%.po=%)
all: update merge all: update merge
update: update:
@cd ../..; python2 tools/translations/extract.py @cd ../..; python2 editor/translations/extract.py
merge: merge:
@for po in $(POFILES); do \ @for po in $(POFILES); do \

View file

@ -17,7 +17,7 @@ for arg in sys.argv[1:]:
os.sys.exit("Non supported argument '" + arg + "'. Aborting.") os.sys.exit("Non supported argument '" + arg + "'. Aborting.")
if (not os.path.exists("tools")): if (not os.path.exists("editor")):
os.sys.exit("ERROR: This script should be started from the root of the git repo.") os.sys.exit("ERROR: This script should be started from the root of the git repo.")
@ -51,7 +51,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\\n" "Content-Transfer-Encoding: 8-bit\\n"
""" """
print("Updating the tools.pot template...") print("Updating the editor.pot template...")
for fname in matches: for fname in matches:
@ -102,20 +102,20 @@ for fname in matches:
f.close() f.close()
f = open("tools.pot", "wb") f = open("editor.pot", "wb")
f.write(main_po) f.write(main_po)
f.close() f.close()
if (os.name == "posix"): if (os.name == "posix"):
print("Wrapping template at 79 characters for compatibility with Weblate.") print("Wrapping template at 79 characters for compatibility with Weblate.")
os.system("msgmerge -w79 tools.pot tools.pot > tools.pot.wrap") os.system("msgmerge -w79 editor.pot editor.pot > editor.pot.wrap")
shutil.move("tools.pot.wrap", "tools.pot") shutil.move("editor.pot.wrap", "editor.pot")
shutil.move("tools.pot", "tools/translations/tools.pot") shutil.move("editor.pot", "editor/translations/editor.pot")
# TODO: Make that in a portable way, if we care; if not, kudos to Unix users # TODO: Make that in a portable way, if we care; if not, kudos to Unix users
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 editor/translations/editor.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 editor/translations/editor.pot | grep \\\-msgid | wc -l", shell=True)
print("\n# 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)))