Skip to content

Commit d454ccb

Browse files
hotlongclaude
andauthored
feat(docs): ship zh-Hant, generated from zh-Hans and committed (#218)
* feat(docs): ship zh-Hant, generated from zh-Hans and committed Docs shipped seven locales; the marketing site ships eight. This adds the missing one, `zh-Hant`, the way `www.objectos.ai` already ships it in production: derived mechanically from the Simplified pages with OpenCC's `s2twp` preset, output committed, hand-editing gated. Committed output rather than conversion at request time is forced by how the locale surface is now derived. `lib/seo.ts`'s `translatedLocales()` tells a real translation from an inherited English fallback by the identity of the source file, so a conversion performed while rendering produces no `zh-Hant` file and the locale would render, switch, and appear in no sitemap entry and no hreflang alternate — invisible to the search engines this exists to reach. Fenced code blocks are copied through byte for byte; everything outside them is converted. The `translation:` stamp is carried across unchanged, which is correct rather than convenient: it records the sha256 of the English sibling the Simplified page was derived from, and the Traditional page is derived from that same English revision, so the two go stale and fresh together. `zh-TW`, `zh-HK` and `zh-MO` now negotiate to `zh-Hant` instead of Simplified, and the comment saying Traditional falls back "until zh-Hant ships" is gone with the condition it described. opencc-js is pinned to the exact version www resolves in production (1.3.1) and is a devDependency: the dictionaries decide the output bytes, so a floating range would rewrite the whole committed corpus on some future install. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5zjYc2BoFV2NjKBBapC7C * fix(ci): compare a derived locale against its source, not against English `check-translation-output.mjs` asks "is this file faithful to the thing it was produced from?", and until now that thing was always the English sibling. It is not, for a locale generated from another locale: Traditional Chinese is produced from the Simplified page, so English is two derivations away and comparing against it measures the wrong pair. Measured, not predicted: comparing the 62 generated Traditional pages against English produced 31 blocking findings, every one a verbatim re-report of a finding already open against the Simplified page it was converted from — debt that is unfixable in the file being accused, because that file is generated and the fix belongs upstream. A gate that accuses a file nobody can edit, for a defect it did not introduce, is a gate people learn to override. Against its real source the same rules become a strict check on the CONVERTER: the generator copies fences through byte for byte and rewrites only Han characters outside them, so `fence`, `url`, `frontmatter` and `component` must match the Simplified source exactly, and `length` runs at a measured 1.00x (n=62, min 1.00, max 1.02) instead of being skipped as uncalibrated. `--calibrate` uses the same base, or it would print a number the rule never compares against. `unsafe` is untouched — it needs no sibling and is never scoped. The self-test gains a three-file fixture per derived locale. Its load-bearing case reproduces the real shape (a source page whose fence differs from English) and asserts BOTH halves: silent against its source, and still red against English. Without the second assertion the case would pass for a validator that had simply stopped checking derived files at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5zjYc2BoFV2NjKBBapC7C * ci: gate the committed zh-Hant output against the generator Committed generated output drifts unless something compares it. This regenerates in memory and compares bytes, so a hand edit, a stale file whose Simplified source was retired, and a converter upgrade nobody re-ran all fail with the same one-line fix. It runs before `type-check` because it needs no build, and because a content drift reported as a type error is a wrong first diagnosis. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5zjYc2BoFV2NjKBBapC7C * docs: record that zh-Hant is generated, not translated Both files stated a seven-locale list that is now false, and neither said what the eighth locale is. A stale fact about locale machinery is the defect this repo has spent the day removing, and here it is also a live hazard: the translation pass reads TRANSLATION.md, and a pass that translates a `zh-Hant` page from English produces a second, divergent Chinese voice that the generator then overwrites. The `--worklist` caveat is stated rather than fixed: it still emits `en -> zh-Hant` items. The bad outcome is caught loudly by `gen-zh-hant.mjs --check` rather than shipped, so this is contained; making the worklist skip derived locales is filed separately. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5zjYc2BoFV2NjKBBapC7C --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e38b2bf commit d454ccb

83 files changed

Lines changed: 9096 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/check-translation-output.mjs‎

Lines changed: 207 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ const LENGTH_TOLERANCE = 0.4;
120120
*/
121121
const LOCALE_EXPANSION = {
122122
'zh-Hans': 0.54,
123+
// Measured against its zh-Hans SOURCE, not against English — see
124+
// `DERIVED_FROM`. Traditional and Simplified are the same text in two
125+
// orthographies, so a correct conversion is 1:1 in characters and the band
126+
// this produces is tight on purpose: it is a check on the converter, not on
127+
// a translator.
128+
'zh-Hant': 1.00,
123129
ja: 0.69,
124130
ko: 0.67,
125131
de: 1.10,
@@ -153,6 +159,49 @@ function walk(dir, out = []) {
153159
const localeOf = (f) => LOCALES.find((l) => f.endsWith(`.${l}.mdx`)) ?? null;
154160
const englishOf = (f, l) => `${f.slice(0, -`.${l}.mdx`.length)}.mdx`;
155161

162+
/**
163+
* Locales DERIVED FROM ANOTHER LOCALE rather than translated from English, and
164+
* the locale each one is derived from.
165+
*
166+
* Every rule below asks "is this file faithful to the thing it was produced
167+
* from?", and until `zh-Hant` shipped that thing was always the English
168+
* sibling. It is not, for a locale generated by
169+
* `apps/docs/scripts/gen-zh-hant.mjs`: Traditional Chinese is produced from the
170+
* SIMPLIFIED page by an orthographic conversion, so the English page is two
171+
* derivations away and comparing against it measures the wrong pair.
172+
*
173+
* That is not a nicety. Measured on the tree this landed on, comparing the 62
174+
* generated Traditional pages against English produced 31 blocking findings,
175+
* every one of them a verbatim re-report of a finding already open against the
176+
* Simplified page it was converted from — debt that is unfixable in the file
177+
* being accused, because the file is generated and the fix belongs upstream.
178+
* A gate that accuses a file nobody can edit for a defect it did not introduce
179+
* is a gate people learn to override.
180+
*
181+
* Compared against its real source the same rules become a genuine check on
182+
* the CONVERTER, and a strict one: the generator copies fenced code blocks
183+
* through byte for byte and rewrites only Han characters outside them, so
184+
* `fence`, `url`, `frontmatter` and `component` must all match the Simplified
185+
* source exactly. A converter that started rewriting a code sample, dropping a
186+
* link or losing a frontmatter key goes red here.
187+
*
188+
* `unsafe` is untouched by any of this — it needs no sibling, runs over the
189+
* whole corpus, and is the one rule that is never scoped.
190+
*/
191+
const DERIVED_FROM = { 'zh-Hant': 'zh-Hans' };
192+
193+
/**
194+
* The file a locale file must be faithful to: its source-locale sibling for a
195+
* derived locale, the English sibling for a translated one.
196+
*/
197+
function sourceOf(f, l) {
198+
const from = DERIVED_FROM[l];
199+
return from ? `${f.slice(0, -`.${l}.mdx`.length)}.${from}.mdx` : englishOf(f, l);
200+
}
201+
202+
/** How a finding names the thing a file was compared against. */
203+
const sourceLabel = (l) => (DERIVED_FROM[l] ? `${DERIVED_FROM[l]} source` : 'English source');
204+
156205
/* ---------------------------------------------------------------- parsing --
157206
* All of it text-level and deliberately small. See the zero-dependency note in
158207
* the header: this has to run with nothing installed.
@@ -396,32 +445,37 @@ function checkUnsafe(path, text) {
396445
return found;
397446
}
398447

399-
/** Fidelity rules. Compare a translation against its English sibling. */
400-
function checkFidelity(localePath, enPath, locale) {
448+
/**
449+
* Fidelity rules. Compare a locale file against the file it was produced from —
450+
* the English sibling for a translated locale, the source-locale sibling for a
451+
* derived one (`DERIVED_FROM`).
452+
*/
453+
function checkFidelity(localePath, sourcePath, locale) {
401454
const t = readFileSync(localePath, 'utf8');
402-
const e = readFileSync(enPath, 'utf8');
455+
const e = readFileSync(sourcePath, 'utf8');
456+
const source = sourceLabel(locale);
403457
const file = rel(localePath);
404458
const found = [];
405459
const add = (rule, detail) => found.push({ rule, file, detail });
406460

407461
const ts = split(stripFrontmatter(t));
408462
const es = split(stripFrontmatter(e));
409463

410-
// 1. fenced code blocks byte-identical to the English source
464+
// 1. fenced code blocks byte-identical to the source
411465
if (ts.fences.length !== es.fences.length) {
412-
add('fence', `${ts.fences.length} code fence(s), English has ${es.fences.length}`);
466+
add('fence', `${ts.fences.length} code fence(s), ${source} has ${es.fences.length}`);
413467
} else {
414468
for (let i = 0; i < es.fences.length; i += 1) {
415469
if (ts.fences[i] !== es.fences[i]) {
416-
add('fence', `code fence #${i + 1} differs from the English source`);
470+
add('fence', `code fence #${i + 1} differs from the ${source}`);
417471
break;
418472
}
419473
}
420474
}
421475

422-
// 2. the page's URL set is a subset of the English page's
476+
// 2. the page's URL set is a subset of its source page's
423477
const extra = [...urls(ts.prose)].filter((u) => !urls(es.prose).has(u));
424-
if (extra.length) add('url', `link(s) the English page does not have: ${extra.join(', ')}`);
478+
if (extra.length) add('url', `link(s) the ${source} does not have: ${extra.join(', ')}`);
425479

426480
// 3. frontmatter keys match exactly (values are translated, keys are not)
427481
const tf = frontmatter(t);
@@ -466,7 +520,7 @@ function checkFidelity(localePath, enPath, locale) {
466520
if (ratio < lo || ratio > hi) {
467521
add(
468522
'length',
469-
`prose is ${ratio.toFixed(2)}x the English page; ${locale} translations run ${expected}x ` +
523+
`prose is ${ratio.toFixed(2)}x the ${source}; ${locale} runs ${expected}x ` +
470524
`(band ${lo.toFixed(2)}–${hi.toFixed(2)})`,
471525
);
472526
}
@@ -483,9 +537,12 @@ function survey() {
483537
findings.push(...checkUnsafe(f, readFileSync(f, 'utf8')));
484538
const l = localeOf(f);
485539
if (!l) continue;
486-
const en = englishOf(f, l);
487-
if (!existsSync(en)) continue; // orphans are check-translations.mjs's verdict
488-
findings.push(...checkFidelity(f, en, l));
540+
const src = sourceOf(f, l);
541+
// A missing source is `check-translations.mjs`'s verdict: an orphan for a
542+
// translated locale, and for a derived one a file the generator no longer
543+
// produces (`gen:zh-hant --check` names it).
544+
if (!existsSync(src)) continue;
545+
findings.push(...checkFidelity(f, src, l));
489546
}
490547
return { files: all.length, findings };
491548
}
@@ -596,11 +653,13 @@ function calibrate() {
596653
for (const f of walk(DOCS).sort()) {
597654
const l = localeOf(f);
598655
if (!l) continue;
599-
const en = englishOf(f, l);
600-
if (!existsSync(en)) continue;
601-
const enLen = proseLength(readFileSync(en, 'utf8'));
602-
if (!enLen) continue;
603-
(byLocale[l] ??= []).push(proseLength(readFileSync(f, 'utf8')) / enLen);
656+
// The same base the gate uses. Calibrating a derived locale against English
657+
// would print a number the `length` rule never compares anything to.
658+
const src = sourceOf(f, l);
659+
if (!existsSync(src)) continue;
660+
const srcLen = proseLength(readFileSync(src, 'utf8'));
661+
if (!srcLen) continue;
662+
(byLocale[l] ??= []).push(proseLength(readFileSync(f, 'utf8')) / srcLen);
604663
}
605664
console.log('Median prose-length ratio per locale (paste into LOCALE_EXPANSION):');
606665
console.log('');
@@ -882,6 +941,129 @@ const SPLIT_CASES = [
882941
{ name: 'comment closing with a space before the brace', doc: 'a {/* c */ } b', comments: ['{/* c */ }'], prose: 'a b' },
883942
];
884943

944+
/**
945+
* Cases for a DERIVED locale (`DERIVED_FROM`), which the two-file harness above
946+
* cannot express: the whole point is which of THREE files the comparison picks.
947+
*
948+
* The fixture reproduces the shape that made this necessary. The source-locale
949+
* page carries a code fence that differs from the English one — the corpus has
950+
* 30 such pages — and the derived page is a faithful conversion of it. Case 1
951+
* asserts both halves of that: silent against its real source, and RED against
952+
* English. Without the second assertion the case would be green for a
953+
* validator that had simply stopped checking derived files at all.
954+
*/
955+
const DERIVED_CASES = [
956+
{
957+
name: 'faithful conversion of a source whose fence differs from English',
958+
expect: [],
959+
alsoRedAgainstEnglish: ['fence'],
960+
},
961+
{
962+
name: 'converter edited a code fence',
963+
expect: ['fence'],
964+
to: (s) => s.replace(SOURCE_FENCE_CMD, `${SOURCE_FENCE_CMD}-v2`),
965+
},
966+
{
967+
name: 'converter invented a link the source does not have',
968+
expect: ['url'],
969+
to: (s) => s.replace('](/docs/configure/permissions)', '](https://example.invalid/zh)'),
970+
},
971+
{
972+
name: 'converter dropped a frontmatter key',
973+
expect: ['frontmatter'],
974+
to: (s) => s.replace(/^description: .*\n/m, ''),
975+
},
976+
{
977+
name: 'converter truncated the page',
978+
expect: ['length'],
979+
to: (s) => s.slice(0, Math.floor(s.length / 2)),
980+
},
981+
];
982+
983+
/** `@generated` marker the generator stamps, as a frontmatter YAML comment. */
984+
const DERIVED_MARKER = '# @generated -- do not edit.';
985+
986+
/**
987+
* The command line inside the SOURCE fixture's fence. Named rather than spelled
988+
* twice: the source deliberately differs from English here, so a case that
989+
* mutated the English spelling would be a no-op replace — a fixture that
990+
* changes nothing and reports green. (It was, on the first run of this block.)
991+
*/
992+
const SOURCE_FENCE_CMD = 'os lint --rule sicherheit-rolle-wort';
993+
994+
/**
995+
* Run `DERIVED_CASES` for every entry in `DERIVED_FROM`, and assert the map
996+
* itself is consistent with `i18n.ts`. A `DERIVED_FROM` entry naming a locale
997+
* that is no longer declared would silently stop being exercised, which is the
998+
* shape of dead configuration this file's own header argues against.
999+
*/
1000+
function derivedTest() {
1001+
let failed = 0;
1002+
for (const [derived, from] of Object.entries(DERIVED_FROM)) {
1003+
for (const [what, l] of [['derived', derived], ['source', from]]) {
1004+
if (!LOCALES.includes(l)) {
1005+
console.error(`✗ DERIVED_FROM names a ${what} locale absent from i18n.ts: "${l}"`);
1006+
failed += 1;
1007+
}
1008+
}
1009+
if (LOCALE_EXPANSION[derived] === undefined) {
1010+
console.error(`✗ derived locale "${derived}" has no LOCALE_EXPANSION entry — length is never judged`);
1011+
failed += 1;
1012+
}
1013+
if (!LOCALES.includes(derived) || !LOCALES.includes(from)) continue;
1014+
1015+
const dir = mkdtempSync(join(tmpdir(), 'translation-derived-'));
1016+
const en = join(dir, 'page.mdx');
1017+
const src = join(dir, `page.${from}.mdx`);
1018+
const out = join(dir, `page.${derived}.mdx`);
1019+
try {
1020+
// The source page's fence deliberately differs from English: that is the
1021+
// debt the derived page must not be accused of inheriting.
1022+
const sourceText = fixtureXx(from).replace('os lint --rule security-role-word', SOURCE_FENCE_CMD);
1023+
if (!sourceText.includes(SOURCE_FENCE_CMD)) {
1024+
throw new Error('derived fixture: the source fence mutation matched nothing');
1025+
}
1026+
writeFileSync(en, fixtureEn());
1027+
writeFileSync(src, sourceText);
1028+
1029+
for (const c of DERIVED_CASES) {
1030+
// A conversion changes characters, not structure, so the derived
1031+
// fixture starts as a byte copy of its source plus the marker.
1032+
const base = sourceText.replace(/^---\n/, `---\n${DERIVED_MARKER}\n`);
1033+
writeFileSync(out, (c.to ?? ((s) => s))(base));
1034+
1035+
const fired = [...new Set(checkFidelity(out, src, derived).map((f) => f.rule))].sort();
1036+
const want = [...c.expect].sort();
1037+
let ok = fired.join(',') === want.join(',');
1038+
1039+
// The other half of case 1: prove the fixture would have been red the
1040+
// old way, so its green is a measurement and not a vacuum.
1041+
if (c.alsoRedAgainstEnglish) {
1042+
const vsEn = [...new Set(checkFidelity(out, en, derived).map((f) => f.rule))]
1043+
.filter((r) => c.alsoRedAgainstEnglish.includes(r))
1044+
.sort();
1045+
if (vsEn.join(',') !== [...c.alsoRedAgainstEnglish].sort().join(',')) {
1046+
console.error(
1047+
` against English this fixture fired [${vsEn.join(' ') || '—'}], ` +
1048+
`expected [${c.alsoRedAgainstEnglish.join(' ')}] — it proves nothing`,
1049+
);
1050+
ok = false;
1051+
}
1052+
}
1053+
1054+
if (!ok) failed += 1;
1055+
console.log(
1056+
`${ok ? '✓' : '✗'} derived ${derived}: ${c.name.padEnd(56)} fired [${fired.join(' ') || '—'}]` +
1057+
(ok ? '' : ` expected [${want.join(' ') || '—'}]`),
1058+
);
1059+
}
1060+
} finally {
1061+
rmSync(dir, { recursive: true, force: true });
1062+
}
1063+
}
1064+
return failed;
1065+
}
1066+
8851067
function selfTest() {
8861068
const locale = LOCALES.find((l) => LOCALE_EXPANSION[l] !== undefined);
8871069
if (!locale) throw new Error('no calibrated locale in i18n.ts — cannot self-test the length rule');
@@ -930,6 +1112,9 @@ function selfTest() {
9301112
}
9311113
}
9321114

1115+
console.log('');
1116+
failed += derivedTest();
1117+
9331118
console.log('');
9341119
const covered = new Set(CASES.flatMap((c) => c.expect));
9351120
for (const rule of RULES) {
@@ -949,9 +1134,12 @@ function selfTest() {
9491134
console.error(`\n✗ self-test: ${failed} case(s) did not behave as declared`);
9501135
process.exit(1);
9511136
}
1137+
const derivedCount = Object.keys(DERIVED_FROM).length * DERIVED_CASES.length;
9521138
console.log(
953-
`✓ self-test: ${CASES.length} rule case(s) and ${SPLIT_CASES.length} split case(s) on locale ` +
954-
`"${locale}" — every rule demonstrated able to fail, every prose rule demonstrated able to stay silent`,
1139+
`✓ self-test: ${CASES.length} rule case(s), ${SPLIT_CASES.length} split case(s) and ` +
1140+
`${derivedCount} derived-locale case(s) on locale "${locale}" — every rule demonstrated able ` +
1141+
`to fail, every prose rule demonstrated able to stay silent, and every derived locale ` +
1142+
`demonstrated to be compared against its source rather than English`,
9551143
);
9561144
}
9571145

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ jobs:
5353
node-version: 22
5454
cache: pnpm
5555
- run: pnpm install --frozen-lockfile
56+
57+
# `content/docs/**/*.zh-Hant.mdx` and `meta.zh-Hant.json` are generated
58+
# from the Simplified siblings by `apps/docs/scripts/gen-zh-hant.mjs` and
59+
# committed, because `lib/seo.ts` tells a real translation from an English
60+
# fallback by the presence of a locale-suffixed FILE — a conversion done
61+
# while rendering would leave the locale out of every sitemap entry and
62+
# hreflang cluster. Committed output needs a gate or it drifts: this
63+
# regenerates in memory and compares bytes, so a hand edit, a stale file
64+
# whose source was retired, and a converter upgrade nobody re-ran all fail
65+
# here with the same one-line fix.
66+
#
67+
# Before `type-check` on purpose: it needs no build, and a content drift
68+
# reported as a type error is a wrong first diagnosis.
69+
- name: Generated zh-Hant is current
70+
run: node apps/docs/scripts/gen-zh-hant.mjs --check
71+
5672
- run: pnpm turbo run type-check --continue
5773
- run: pnpm turbo run build
5874

‎AGENTS.md‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ObjectOS — the commercial runtime environment for ObjectStack applications (Cl
1010

1111
### 1. English is the single source of truth for all content
1212

13-
All marketing copy, UI strings, and documentation are authored in **English first**. Every other locale (`zh-Hans`, `ja`, `de`, `es`, `fr`, `ko`) is a **translation derived from English**.
13+
All marketing copy, UI strings, and documentation are authored in **English first**. Every other locale (`zh-Hans`, `ja`, `de`, `es`, `fr`, `ko`) is a **translation derived from English**. `zh-Hant` is derived one step further — it is generated from `zh-Hans` by `apps/docs/scripts/gen-zh-hant.mjs`, never translated and never hand-written (see [Traditional Chinese](#traditional-chinese-is-generated-not-translated)).
1414

1515
- **Edit English, and only English.** Translations are generated, not authored — a PR that hand-edits a locale file is rejected by CI (see [Translation workflow](#translation-workflow)).
1616
- If a typo or wording change only appears in a translation, fix English. The translation is re-derived from it.
@@ -37,7 +37,7 @@ Stack: Next.js 16 App Router + Fumadocs UI 16 + Fumadocs MDX. Many UI affordance
3737

3838
### Locale conventions
3939

40-
- Supported locales, as BCP 47 tags — `apps/docs/lib/i18n.ts` is the authority: `en` (default), `zh-Hans`, `ja`, `de`, `es`, `fr`, `ko`.
40+
- Supported locales, as BCP 47 tags — `apps/docs/lib/i18n.ts` is the authority: `en` (default), `zh-Hans`, `zh-Hant`, `ja`, `de`, `es`, `fr`, `ko`.
4141
- ⛔ **There is no `cn` locale.** It is a legacy code that `middleware.ts` 308-redirects to `zh-Hans`. A file named `foo.cn.mdx` would never render **and would raise no error** — it is simply ignored, which is the worst possible failure mode for a translation. Simplified Chinese is `zh-Hans`.
4242
- Default locale has no prefix (`/docs/...`); other locales are prefixed (`/zh-Hans/docs/...`). This is set by `hideLocale: 'default-locale'` in `lib/i18n.ts`.
4343
- **MDX translations:** add a sibling file with the locale tag next to the English `.mdx` — `foo.zh-Hans.mdx`, `foo.ja.mdx`, and so on. Fumadocs auto-falls-back to English when a translation is missing — you can ship translations incrementally without breaking links.
@@ -48,6 +48,32 @@ Stack: Next.js 16 App Router + Fumadocs UI 16 + Fumadocs MDX. Many UI affordance
4848

4949
Folder `meta.json` files declare a section's title, page order, and `defaultOpen: false` to make the group collapsible and collapsed by default. The root `content/docs/meta.json` references folders by name (`"deploy"`, `"build"`, …), not by the `"...deploy"` spread + `---Deploy---` separator pattern (the old pattern produced a flat ~50-item sidebar).
5050

51+
### Traditional Chinese is generated, not translated
52+
53+
`zh-Hant` is the one locale with no translation pass behind it. Simplified and
54+
Traditional Chinese are one language in two orthographies, so the Traditional
55+
pages are produced from the Simplified ones by an orthographic conversion
56+
(OpenCC `s2twp`, the same preset `www.objectos.ai` runs) and committed:
57+
58+
```bash
59+
pnpm --filter @objectos/docs gen:zh-hant # rewrite the Traditional set
60+
pnpm --filter @objectos/docs gen:zh-hant --check # what CI runs
61+
```
62+
63+
- ⛔ **Never hand-edit a `*.zh-Hant.mdx` or `meta.zh-Hant.json` file**, and never
64+
translate one from English. Fix the English source; the Simplified page is
65+
re-derived from it and the Traditional page from that. CI runs `--check` on
66+
every PR and fails on any byte of drift.
67+
- Retiring a page or its Simplified sibling takes the Traditional file with it —
68+
re-run the generator, which prunes what it no longer produces.
69+
- Coverage tracks Simplified exactly (62 of 79 pages today). The 17 without a
70+
Simplified sibling have no Traditional one either, so they are never
71+
advertised in the sitemap or an hreflang cluster — they simply render English.
72+
- Committed output, not on-the-fly conversion, because `lib/seo.ts` tells a real
73+
translation from an English fallback by the presence of a locale-suffixed
74+
file. A conversion done while rendering produces no such file, and the locale
75+
would be invisible to search engines while looking correct in a browser.
76+
5177
### Translation workflow
5278

5379
**You edit English. You do not edit translations.** Every `*.<locale>.mdx` file is a derived artifact, refreshed by a separate periodic pass under [`docs/TRANSLATION.md`](docs/TRANSLATION.md). `.github/scripts/check-translation-ownership.mjs` rejects any PR that mixes the two — hand-maintained siblings used to be **86% of the diff** in a typical docs PR, which is the cost this split removes.
@@ -71,6 +97,7 @@ node .github/scripts/check-translations.mjs --worklist # what the next pass wil
7197
- Don't set `alt="ObjectOS"` on the logo image when the adjacent text already says "ObjectOS" — screen readers read it twice. Use `alt=""` + `aria-hidden`.
7298
- Don't add translation-only strings or files. If it doesn't have an English source, it shouldn't exist yet.
7399
- Don't write a `.cn.mdx` sibling. That locale does not exist; the file is ignored silently. Use `.zh-Hans.mdx`.
100+
- Don't hand-write a `.zh-Hant.mdx` sibling either. It is generated from the `.zh-Hans.mdx` file and CI fails on any hand edit.
74101
- Don't hand-edit a `*.<locale>.mdx` file, and don't "just fix" one while you're in there. Fix the English source instead.
75102

76103
## Commands

0 commit comments

Comments
 (0)