docs: make translations best effort

Merged
KA
13d ago
+109-52

English docs are the source of truth. The Japanese and Chinese translations are now best effort: they may lag behind English, and a contributor never has to update a language they don't speak.

  • scripts/check-docs-translations.ts warns instead of failing when a translation drifts from its English page: the outline (headings, <Tab>, <Accordion>, id), a code block, or a navigation label. On GitHub Actions each warning is a Stale translation annotation on the file. An outline warning says what drift costs on the site: the page gets ids of its own, so links to its anchors and the language switcher miss.
  • It still fails on what needs no language to fix: a translation whose English page is gone, a translation with no title, a language with no navigation.json. check-docs-anchors.ts is unchanged, so a renamed English anchor still means fixing the #anchor links to it in the translations.
  • AGENTS.md, the authoring-docs skill, and docs/ja/README.md / docs/zh/README.md say translations are best effort. The checklist item "mirror a changed outline in docs/ja/ and docs/zh/" became "move or delete translations with their English page".
  • The DeepL review comments (check-docs-translations-deepl.ts, deepl-review.ts, docs-translations.yml) no longer say the outline is guaranteed to match. A drifted page is still skipped there with a notice.

The site already copes with a stale translation (e2e-site lib/docs/remark-docs.ts: a page whose outline differs keeps its own ids; lib/docs/source.ts: a missing label falls back to English).

Verified

Ran it locally: yes

  • pnpm check passes; the translation check reports 162 of 162 pages in line.
  • Added a ## heading and a code block to docs/quickstart.mdx and a group to docs/docs.json, then ran the check. Exit 0, with warnings for both languages:
warning: docs/ja/quickstart.mdx: heading #8 is missing, the English page has h2 (8 vs 7 in all); until the outline matches, the site gives this page ids of its own, so links to its anchors and the language switcher miss
warning: docs/ja/quickstart.mdx: code block #17 differs from the English page's (17 vs 16 in all)
warning: docs/ja/navigation.json: no label in "groups" for "Brand new"
  • The same with GITHUB_ACTIONS=true prints ::warning file=docs/ja/quickstart.mdx::Stale translation: ... annotations.
  • docs/ja/orphan.mdx with no English page still exits 1.

Linear: ENG-1385