Doc Page
Localization
Organize locale overlays and fallback strategy for docs and examples.
Locale Model
The docs system resolves content by locale and adapter. English shared content is the canonical fallback. Locale overlays can replace individual sections while preserving the same slug and route structure.
Routes follow:
/{locale}/{adapter}/docs/{slug}Current locales:
enzh-cn
Current adapters:
reactvanillavuesolidsvelte
Sources: shared/en/localization
Content Layers
Docs content is layered:
shared/<locale>/<slug>.md<adapter>/<locale>/<slug>.md- fallback to
enwhen a locale file is missing - fallback to React adapter overlay only when an adapter-specific overlay is missing
Adapter overlays should be used only when the page truly differs by adapter. Do not duplicate shared content just to restate the same contract.
Sources: shared/en/localization
What To Localize
Localize user-facing prose:
- Page title and summary.
- Setup instructions.
- Example labels.
- Troubleshooting suggestions.
- Validation explanations.
Keep technical identifiers stable:
- Slugs.
- Section IDs in
[id:...]. - Package names.
- Data attributes.
- ARIA attributes.
- Rule IDs.
- Command names.
Stable identifiers make translated docs easier for agents and validators to cross-reference.
Sources: shared/en/localization
Adapter-Aware Links
When writing shared docs, avoid hard-coding a single adapter route unless the destination is intentionally adapter-specific. Prefer prose such as "open the route-local quick start" or link from adapter overlays where the correct adapter is known.
When writing adapter overlays, link to the same adapter route:
[Adapter Integration](/en/vue/docs/adapter-integration)This prevents Vue, Solid, and Svelte pages from sending readers into React-only setup instructions.
Sources: shared/en/localization
Examples
Examples can localize visible labels while keeping behavior contracts stable:
- Option IDs remain stable.
valuefields remain stable unless the example is explicitly locale-specific.- Accessible names are translated.
aria-labeland helper text are translated.data-uianddata-slotnever change by locale.
Sources: shared/en/localization
Validation
Run:
pnpm content:build
pnpm content:checkContent checks validate frontmatter, links, generated indexes, and stale artifacts. They do not replace native-speaker review for translated prose.
Sources: shared/en/localization
Pitfalls
- Translating package names or rule IDs.
- Changing slugs between locales.
- Hard-coding React links from shared pages.
- Letting untranslated fallback hide docs debt.
- Localizing visible text but forgetting accessible labels.
Sources: shared/en/localization
Checklist
- Slug and section IDs match the canonical page.
- Technical identifiers are unchanged.
- Adapter-specific pages link to the current adapter route.
- Examples translate visible and accessible text together.
- Fallback pages are tracked as docs debt.
Sources: shared/en/localization