From ad727b96cfd6d2c17c8c6012a1ca1416f17a4b22 Mon Sep 17 00:00:00 2001 From: Cloudburst <18114966+C10udburst@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:40:03 +0200 Subject: [PATCH] [skip ci] match weblate xml style --- .github/locales.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/locales.py b/.github/locales.py index 76f85c1f..a74d7258 100644 --- a/.github/locales.py +++ b/.github/locales.py @@ -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'\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}")