Skip to content

The only downloader you need. 下载器的集大成者。

fix: escapeAndroidXml 避免对已转义引号二次转义

XiaoYouChR8f1d314a62a1
diff --git a/scripts/translate_i18n.py b/scripts/translate_i18n.py
index 3a122231..dc8553f7 100644
--- a/scripts/translate_i18n.py
+++ b/scripts/translate_i18n.py
@@ -410,9 +410,9 @@ def parseAndroidResponse(text: str) -> dict[str, str]:
def escapeAndroidXml(text: str) -> str:
- for old, new in (("&", "&amp;"), ("<", "&lt;"), (">", "&gt;"),
- ("'", "\\'"), ('"', '\\"')):
- text = text.replace(old, new)
+ text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+ text = re.sub(r"(?<!\\)'", "\\'", text)
+ text = re.sub(r'(?<!\\)"', '\\"', text)
return text