[skip ci] match weblate xml style

This commit is contained in:
Cloudburst 2024-08-02 11:40:03 +02:00 committed by GitHub
parent 67e278b2b7
commit ad727b96cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

5
.github/locales.py vendored
View file

@ -1,6 +1,7 @@
import re
import glob
import requests
import os
import lxml.etree as ET # builtin library doesn't preserve comments
@ -61,6 +62,8 @@ for file in glob.glob(f"{XML_NAME}*/strings.xml"):
with open(file, 'wb') as fp:
fp.write(b'<?xml version="1.0" encoding="utf-8"?>\n')
tree.write(fp, encoding="utf-8", method="xml", pretty_print=True, xml_declaration=False)
fp.write(b'\n')
# Remove trailing new line to be consistent with weblate
fp.seek(-1, os.SEEK_END)
fp.truncate()
except ET.ParseError as ex:
print(f"[{file}] {ex}")