Files
dragon-hd/tools/dump_all_strings.py
DragonHD ca5748821c Translate Strings.dat to Simplified Chinese (479/496)
- cn_strings.py: full GB2312 translation table; make_cn_strings.py is now
  escape-aware so values containing escaped-quote formats survive.
- dump_all_strings.py + check_translations.py: dump the English table and
  verify the printf specifier sequence matches the source (0 mismatches).
- Skipped: pure-format/empty strings, the tutorial texture path, ambiguous
  key labels.
- DEVLOG notes the remaining engine-layout caveats.
2026-09-20 10:44:10 +08:00

17 lines
491 B
Python

import json
import re
import sys
raw = open(r"E:\DragonHD\backup_game\Strings.dat", "rb").read()
pat = re.compile(
rb'Id\s*=\s*"([^"]*)"\s*[\r\n]+\s*English\s*=\s*"((?:[^"\\]|\\.)*)"',
re.S,
)
out = []
for m in pat.finditer(raw):
out.append([m.group(1).decode("latin1"), m.group(2).decode("latin1")])
print("entries:", len(out))
dst = r"E:\DragonHD\build\strings_en.json"
open(dst, "w", encoding="utf-8").write(json.dumps(out, ensure_ascii=False, indent=0))
print("wrote", dst)