Skip to content

Add Chinese manual translation and per-locale manual support - #235

Closed
ZacharyZhang-NY wants to merge 1 commit into
omacom:masterfrom
ZacharyZhang-NY:zh-cn-manual
Closed

ZacharyZhang-NY wants to merge 1 commit into
omacom:masterfrom
ZacharyZhang-NY:zh-cn-manual

Conversation

@ZacharyZhang-NY

@ZacharyZhang-NY ZacharyZhang-NY commented Sep 7, 2026 •

Copy link
Copy Markdown

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.json holds { slug: { title, sourceHash } } and src/i18n/<locale>/manual/<slug>.html holds the chapter body. Hashes are computed from src/data/manual.json with the same helper news translations use, so an English edit automatically invalidates the translation.
  • translateManualChapter in src/i18n/content.ts swaps 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.
  • The manual index, chapter pages, search index and SEO titles/descriptions all read the translated chapters. The five manual UI strings are only required from locales that set manual: true.
  • foldHeadingLinks now tolerates whitespace around heading anchors, since Prettier wraps longer translated headings.
  • check-translations.mjs requires every chapter for locales with a manual, verifies the source hash, and checks that the set of href, src and id attributes is identical to the English chapter.
  • verify-locales.py includes /manual/ and every chapter page for locales with a manual, and skips alternate links and footer language links for locales without one.
  • docs/translations.md documents the new files and flag.

zh-CN

  • manual: true in locales.json and all 51 chapters translated, following the wording and register of the existing zh-CN UI, blocks and news translations.
  • Commands, menu paths, code blocks, links, ids and images are unchanged from the English chapters.

Verification

  • npm run check:translations -- zh-CN: 239 UI messages, 21 news articles, 51 manual chapters.
  • npx tsc --noEmit, npx eslint src scripts, npm test pass.
  • npm run build:locale -- zh-CN builds; python3 scripts/verify-locales.py zh-CN verifies 89 pages and 21 RSS articles.
  • English and every other locale still redirect /manual/* to the English site as before.

@ZacharyZhang-NY
ZacharyZhang-NY marked this pull request as draft September 7, 2026 20:50
@ZacharyZhang-NY
ZacharyZhang-NY marked this pull request as ready for review September 7, 2026 20:50
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.
@dhh

dhh commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The manual fallback is useful, but the checker currently makes a stale manual sourceHash fatal even in non-strict mode. Our background workflow runs npm run check:translations before deploying any languages and has no manual translation queue, so an English manual edit would block all language deployments. Please make freshness enforcement opt-in for strict/manual review, retain the English fallback, and add tests for missing and stale chapters. We also need a dedicated technical review of translated commands and installation instructions before enabling the manual.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing this as superseded. #808 publishes the zh-CN manual, along with 48 other languages, rendered from omarchy's own translated manual/zh-CN/ and pinned to the latest release. It uses a different format for src/i18n/zh-CN/manual.json, so the two would conflict. Improvements to the Chinese wording now belong in omarchy's manual/zh-CN/.

This PR also touched things #808 didn't, and I haven't confirmed whether they're still gaps:

  • translated chapter titles and descriptions in src/astro/page-seo.ts
  • the manual UI strings in src/i18n/messages/zh-CN.json
  • the manual checks in scripts/verify-locales.py and scripts/check-translations.mjs

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 quattro as of today, with an independent second opinion from Opus 5.5 High that reached the same conclusion (its independence is not guaranteed).

@omarchybot omarchybot closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants