Files
Starlight_Lancher/tools/icon_work/fix_locales.py
Ap_Tx 5b2cc3f94e
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
feat:一些版权描述的语言
2026-09-13 14:01:04 +08:00

33 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os, glob
ROOT = r"D:\Project\Starlight_Lancher"
LOCALES = os.path.join(ROOT, "apps", "app-frontend", "src", "locales")
REPLACEMENTS = {
"en-US": (
'"message": "Starlight Launcher is a modified version of the open-source Modrinth codebase."',
'"message": "Starlight Launcher is a modified version of the Axolotl Launcher, which is based on the open-source Modrinth codebase."',
),
"zh-CN": (
'"message": "Starlight Launcher 是开源项目 Modrinth 代码库的修改版本。"',
'"message": "Starlight Launcher 是基于 Axolotl 启动器修改的版本Axolotl 启动器基于开源项目 Modrinth 代码库。"',
),
"zh-TW": (
'"message": "Starlight Launcher 是開源專案 Modrinth 程式碼庫的修改版本。"',
'"message": "Starlight Launcher 是基於 Axolotl 啟動器修改的版本Axolotl 啟動器基於開源專案 Modrinth 程式碼庫。"',
),
}
for lang, (old, new) in REPLACEMENTS.items():
p = os.path.join(LOCALES, lang, "index.json")
t = open(p, encoding="utf-8").read()
if old not in t:
print(f"{lang}: 找不到原句,跳过")
continue
t = t.replace(old, new, 1)
open(p, "w", encoding="utf-8", newline="\n").write(t)
import json
json.load(open(p, encoding="utf-8")) # 校验合法
print(f"{lang}: 已改")