Repository navigation
Add Chinese manual translation and per-locale manual support - #235
ZacharyZhang-NY wants to merge 1 commit into
Conversation
37e1004 to
b34e342
Compare
Locales can now ship a translated manual. Chapters live in src/i18n/<locale>/manual/<slug>.html with titles and source hashes in src/i18n/<locale>/manual.json, checked against src/data/manual.json the same way news translations are. A missing or stale chapter falls back to the English original behind a short notice, so a manual can never render half-translated content silently. The manual index, chapter pages, search index and page SEO strings all read the translated chapters. check-translations verifies hashes and that every href, src and id survives translation, and verify-locales covers manual pages for locales with a manual. zh-CN enables the manual with all 51 chapters translated in the register of the existing zh-CN edition.
b34e342 to
c800543
Compare
|
The manual fallback is useful, but the checker currently makes a stale manual sourceHash fatal even in non-strict mode. Our background workflow runs |
|
Closing this as superseded. #808 publishes the zh-CN manual, along with 48 other languages, rendered from omarchy's own translated This PR also touched things #808 didn't, and I haven't confirmed whether they're still gaps:
If a zh-CN manual page still shows English SEO titles or labels, a small follow-up for those would be welcome. Thank you @ZacharyZhang-NY. The per-locale manual idea is what shipped. Please reopen if something is still missing. Checked by Opus 5.5 in Claude Code against |
The manual was English-only for every locale. This adds a way for a locale to ship a translated manual, and uses it for zh-CN.
Mechanism
src/i18n/<locale>/manual.jsonholds{ slug: { title, sourceHash } }andsrc/i18n/<locale>/manual/<slug>.htmlholds the chapter body. Hashes are computed fromsrc/data/manual.jsonwith the same helper news translations use, so an English edit automatically invalidates the translation.translateManualChapterinsrc/i18n/content.tsswaps in the translated title and body. A missing or stale chapter renders the English original behind a short "not translated yet" notice instead of failing the build.manual: true.foldHeadingLinksnow tolerates whitespace around heading anchors, since Prettier wraps longer translated headings.check-translations.mjsrequires every chapter for locales with a manual, verifies the source hash, and checks that the set ofhref,srcandidattributes is identical to the English chapter.verify-locales.pyincludes/manual/and every chapter page for locales with a manual, and skips alternate links and footer language links for locales without one.docs/translations.mddocuments the new files and flag.zh-CN
manual: trueinlocales.jsonand all 51 chapters translated, following the wording and register of the existing zh-CN UI, blocks and news translations.Verification
npm run check:translations -- zh-CN: 239 UI messages, 21 news articles, 51 manual chapters.npx tsc --noEmit,npx eslint src scripts,npm testpass.npm run build:locale -- zh-CNbuilds;python3 scripts/verify-locales.py zh-CNverifies 89 pages and 21 RSS articles./manual/*to the English site as before.