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:
parent
1587505389
commit
1ed99835a0
@ -67,10 +67,11 @@ for d in sorted(glob.glob(os.path.join(resdir, 'values-*'))):
|
|||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8'))
|
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:
|
with open(str_path, 'w+') as f:
|
||||||
f.write(header)
|
f.write(re.sub(r"'", r'"', header))
|
||||||
f.write(result)
|
f.write(result)
|
||||||
f.write('\n')
|
|
||||||
|
|
||||||
sys.exit(count)
|
sys.exit(count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user