remove-unused-and-blank-translations.py: force Android/Weblate XML format

https://github.com/WeblateOrg/weblate/issues/1886
https://github.com/WeblateOrg/weblate/issues/2333
This commit is contained in:
Hans-Christoph Steiner 2019-02-15 14:46:11 +01:00
parent 1587505389
commit 1ed99835a0

View File

@ -67,10 +67,11 @@ for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))):
count += 1
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8'))
result = re.sub(r'resources><string', r'resources>\n <string', result)
result = re.sub(r'[ \t]*</resources>', r'</resources>', result)
with open(str_path, 'w+') as f:
f.write(header)
f.write(re.sub(r"'", r'"', header))
f.write(result)
f.write('\n')
sys.exit(count)