copy ftl to source folder in extra-po-string as well

This commit is contained in:
Damien Elmes 2020-03-12 19:11:37 +10:00
parent d457ab0b17
commit 6514f18e3a

View File

@ -5,6 +5,7 @@ import json
import re
import sys
import polib
import shutil
from fluent.syntax import parse, serialize
from fluent.syntax.ast import Message, TextElement, Identifier, Pattern, Junk
@ -12,9 +13,6 @@ from fluent.syntax.ast import Message, TextElement, Identifier, Pattern, Junk
# eg:
# $ python extract-po-string.py strings.json /path/to/templates/media-check.ftl delete-unused "Delete Unused Media" ""
# $ python extract-po-string.py strings.json /path/to/templates/media-check.ftl delete-unused "%(a)s %(b)s" "%(a)s=$val1,%(b)s=$val2"
#
# NOTE: the English text is written into the templates folder of the repo, so must be copied
# into Anki's source tree
json_filename, ftl_filename, key, msgid_substring, repls = sys.argv[1:]
@ -156,4 +154,9 @@ for lang, translation in to_insert:
add_message(ftl_path, key, translation)
# copy file from repo into src
srcdir = os.path.join(i18ndir, "..", "..")
src_filename = os.path.join(srcdir, os.path.basename(ftl_filename))
shutil.copy(ftl_filename, src_filename)
print("done")