Repository navigation
Pixel Composer 中文汉化包 v1.0.3 —— ② 改为联网同步汉化包
Pixel Composer 中文汉化包 v1.0.3
本版把 ②「更新汉化」重做成「同步最新汉化」:不再在用户机器上跑翻译引擎,
改为从 GitHub 直接下载已经翻好的成品包。
主要变更 / Highlights
1. ② 改为「从 GitHub 同步成品汉化包」
- 依次尝试三个下载源:GitHub Pages → jsDelivr CDN → GitHub Raw,任一可用即停止;
某源下载/校验失败会自动换下一个源重试。 - 用 sha256 逐文件比对,只下载有变化的文件。11 MB 的中文字体通常只在
首次同步时下载一次,之后每次一般只有几十 KB 的 json。 - 备份现有
zh后整包写入两个数据目录(LocalAppData与游戏目录)。 - 断网或三个源都不可达时,自动回退到随附的汉化包,不会让汉化"变空"。
- 已是最新时直接提示「无需更新」,不做任何改动。
- 可用环境变量
PCCN_SOURCE指定镜像源。
2. 分工改为「维护者翻一次,客户端只取成品」
- 新增
build/sync_upstream.py(维护者侧):同步上游官方语言包 → 补翻新增/残留
→ 写zh/与zh/manifest.json→--push自动提交推送。 - 新增
zhsync.py(客户端侧):拉清单、比对哈希、按需下载安装。 patch_tool.py里原先"在本地抽pack/locale.zip再用内置引擎补翻"的两条路径
(extract_en_base/regenerate_from_en)已移除 —— 客户端不再携带翻译逻辑。
3. 修复了一个会让同步"每次重下整包"的真问题
Windows 上 core.autocrlf=true 时,工作区检出是 CRLF、Git 仓库与 GitHub 上是 LF:
同一个 junctions.json 本地 349 B / 线上 330 B,words.json 差 2 KB、
nodes.json 差 45 KB —— 哈希永远对不上,每次同步都误判"文件变了"。
解法是在提交层面统一换行(新增 .gitattributes:包内文本 LF、字体 binary),
而不是在哈希层面抹平差异 —— 后者会误伤字体:LXGW 字体本身含 4926 处
0x0D0A 字节对,归一等于把字体改坏,还会让"字体损坏"检测不出来。
4. 其他
- ⑤ 查看状态 现在会显示已安装汉化包的版本(来自
zh/manifest.json)。 - 命令行新增
--sync(与--update等价)。 - 已知限制补一条:内置参考文档
notes/(混合模式 / L 系统 / MK 面板)目前未翻译。
升级提示 / Upgrading
如果你用的是 v1.0.2 或更早:首次点「② 同步最新汉化」会因为换行统一而重新拉取
一次文本文件(约 700 KB,字体不重下),之后每次同步就只拉真正变化的文件了。
如果你从未用过本工具,直接点「① 一键汉化」即可(离线可用)。
实测记录 / Verified
--install→ 两个数据目录的 8/8 个文件与清单逐字节一致;--sync(已最新)→ 报「无需更新」,不做改动;- 故意改动
nodes.json后--sync→ 日志「需同步 1 个文件,其余从本地复用」,
只下载该文件,11 MB 字体复用未重下; - 断网/清单不可达 → 自动回退随附包(三个源 404 场景已实测)。
与旧社区包对比
| 旧社区包 | 本方案 | |
|---|---|---|
| 更新速度 | 慢,手动发布 | 维护者定期同步上游,客户端一键取最新 |
| 联网需求 | 常需联网取包 | 装好后离线可用;② 联网只取更新 |
| 可回滚 | 通常不支持 | 备份 + 一键回滚(④) |
- 覆盖率:官方词条 1888 / 1916 = 98.5%(其余为品牌名/格式名,按约定保留英文);节点约 93%。
- 官网:https://dc1024.github.io/pixel-composer-cn/
下载 / Download
PixelComposer-CN-Patcher.exe —— 免安装、双击即用(已内嵌完整 zh 汉化包)。
下载 → 双击 → 点「① 一键汉化」→ 重启 Pixel Composer。
v1.0.3 reworks button ② into an online sync of a finished pack: the client no longer
runs a translation engine. It fetches zh/manifest.json from three sources in order
(GitHub Pages → jsDelivr → GitHub Raw), compares sha256 per file, and downloads only
changed files (the 11 MB CJK font is normally a one-time download). The existing zh
is backed up before installing to both data roots; if offline it falls back to the bundled
pack, and if already current it reports "nothing to update".
Translation now happens once on the maintainer side (build/sync_upstream.py) instead
of once per user machine — consistent results, no engine shipped to clients.
This release also fixes a real bug that made every sync re-download the whole pack: with
core.autocrlf=true on Windows the working tree is CRLF while Git/GitHub store LF
(junctions.json 349 B local vs 330 B remote; nodes.json differed by 45 KB), so hashes
could never match. Fixed at the commit level via .gitattributes (LF for pack text,
binary for fonts) — normalizing CRLF inside the hash was rejected because it would
corrupt and mask damage in the LXGW font, which legitimately contains 4926 0x0D0A pairs.
Also: ⑤ Status now shows the installed pack version; new --sync flag; known limitation
added for the untranslated notes/ reference docs.