forked from AxTps/Starlight_Lancher
feat:一些版权描述的语言
This commit is contained in:
10
tools/icon_work/fix_162.py
Normal file
10
tools/icon_work/fix_162.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\ui\settings\AboutSettings.vue"
|
||||
t = open(p, encoding="utf-8").read()
|
||||
old = "defaultMessage: 'Starlight Launcher is a modified version of the open-source Modrinth codebase.',"
|
||||
new = "defaultMessage: 'Starlight Launcher is a modified version of the Axolotl Launcher, which is based on the open-source Modrinth codebase.',"
|
||||
assert old in t, "找不到第162行原句"
|
||||
t = t.replace(old, new, 1)
|
||||
open(p, "w", encoding="utf-8", newline="\n").write(t)
|
||||
print("done")
|
||||
print("新句:", new)
|
||||
20
tools/icon_work/fix_copyright.py
Normal file
20
tools/icon_work/fix_copyright.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
f1 = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\ui\settings\AboutSettings.vue"
|
||||
t1 = open(f1, encoding="utf-8").read()
|
||||
old1 = "defaultMessage: 'Copyright © Starlight All Rights Reserved.',"
|
||||
new1 = "defaultMessage: 'Copyright © Axolotl All Rights Reserved.',"
|
||||
assert old1 in t1, "AboutSettings 找不到版权行"
|
||||
t1 = t1.replace(old1, new1, 1)
|
||||
open(f1, "w", encoding="utf-8", newline="\n").write(t1)
|
||||
|
||||
f2 = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\pages\Settings.vue"
|
||||
t2 = open(f2, encoding="utf-8").read()
|
||||
old2 = "Powered by Starlight"
|
||||
new2 = "Powered by Axolotl"
|
||||
assert old2 in t2, "Settings 找不到 Powered by 行"
|
||||
t2 = t2.replace(old2, new2, 1)
|
||||
open(f2, "w", encoding="utf-8", newline="\n").write(t2)
|
||||
|
||||
print("done")
|
||||
print("AboutSettings:142 ->", new1)
|
||||
print("Settings:379 ->", new2)
|
||||
32
tools/icon_work/fix_locales.py
Normal file
32
tools/icon_work/fix_locales.py
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
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}: 已改")
|
||||
42
tools/icon_work/scan_attr.py
Normal file
42
tools/icon_work/scan_attr.py
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
import os, re
|
||||
|
||||
ROOT = r"D:\Project\Starlight_Lancher"
|
||||
DIRS = [
|
||||
"apps/app-frontend/src",
|
||||
"packages/ui/src",
|
||||
"packages/app-lib/src",
|
||||
"apps/app/src",
|
||||
]
|
||||
KEYWORDS = re.compile(
|
||||
r"Copyright|All Rights|Powered by|attribution|Attribution|"
|
||||
r"modified version|based on|版权所有|版权归|署名|致谢|鸣谢|"
|
||||
r"credit|Credit|acknowledg|Acknowledg",
|
||||
re.I,
|
||||
)
|
||||
|
||||
hits = []
|
||||
for d in DIRS:
|
||||
base = os.path.join(ROOT, d)
|
||||
if not os.path.isdir(base):
|
||||
continue
|
||||
for dp, dn, fn in os.walk(base):
|
||||
dn[:] = [x for x in dn if x not in ("node_modules", "dist", "target", ".git")]
|
||||
for f in fn:
|
||||
if not f.endswith((".ts", ".vue", ".rs", ".js", ".json")):
|
||||
continue
|
||||
p = os.path.join(dp, f)
|
||||
if "locales" in p and not p.endswith("en-US/index.json") and not p.endswith("zh-CN/index.json"):
|
||||
continue
|
||||
try:
|
||||
lines = open(p, encoding="utf-8").read().split("\n")
|
||||
except Exception:
|
||||
continue
|
||||
for i, line in enumerate(lines, 1):
|
||||
if "Starlight" in line and KEYWORDS.search(line):
|
||||
hits.append((os.path.relpath(p, ROOT), i, line.strip()))
|
||||
|
||||
print(f"含版权/归属性质且提到 Starlight 的行:{len(hits)}\n")
|
||||
for h in hits:
|
||||
print(f"{h[0]}:{h[1]}")
|
||||
print(f" {h[2][:160]}")
|
||||
24
tools/icon_work/scan_locales.py
Normal file
24
tools/icon_work/scan_locales.py
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
import os, glob
|
||||
|
||||
ROOT = r"D:\Project\Starlight_Lancher"
|
||||
LOCALES = os.path.join(ROOT, "apps", "app-frontend", "src", "locales")
|
||||
|
||||
KEYS = [
|
||||
"app.settings.about.copyright",
|
||||
"app.settings.about.attribution",
|
||||
]
|
||||
|
||||
for path in sorted(glob.glob(os.path.join(LOCALES, "*", "index.json"))):
|
||||
lang = os.path.basename(os.path.dirname(path))
|
||||
try:
|
||||
lines = open(path, encoding="utf-8").read().split("\n")
|
||||
except Exception:
|
||||
continue
|
||||
for i, line in enumerate(lines):
|
||||
for key in KEYS:
|
||||
if f'"{key}"' in line:
|
||||
# 取下一行的 message
|
||||
msg = lines[i + 1].strip() if i + 1 < len(lines) else ""
|
||||
print(f"{lang} | {key}")
|
||||
print(f" {msg[:150]}")
|
||||
7
tools/icon_work/verify_copyright.py
Normal file
7
tools/icon_work/verify_copyright.py
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
a = open(r"D:\Project\Starlight_Lancher\apps\app-frontend\src\components\ui\settings\AboutSettings.vue", encoding="utf-8").read()
|
||||
b = open(r"D:\Project\Starlight_Lancher\apps\app-frontend\src\pages\Settings.vue", encoding="utf-8").read()
|
||||
print("AboutSettings 含 Axolotl 版权:", "Copyright \u00a9 Axolotl All Rights Reserved." in a)
|
||||
print("AboutSettings 还含 Starlight 版权:", "Copyright \u00a9 Starlight All Rights Reserved." in a)
|
||||
print("Settings 含 Powered by Axolotl:", "Powered by Axolotl" in b)
|
||||
print("Settings 还含 Powered by Starlight:", "Powered by Starlight" in b)
|
||||
Reference in New Issue
Block a user