Skip to Content
agore-skill
Explanation

i18n strategy

Why two explicit locales, a chooser root, and a mirrored content tree.

Why does the docs site redirect nowhere, hide no default locale, and mirror its whole content tree — instead of auto-detecting a browser language and serving one canonical tree? Because docs URLs are coordinates, and coordinates should not move under the reader.

Explicit locales everywhere

Every content URL carries its locale: /en/docs/…, /zh/docs/…. Three reasons:

  1. Stable sharing. A link pasted into an issue, a README or a chat keeps its language forever. Auto-detection plus a hidden default makes "the same URL" mean different things for different people.
  2. Static-friendly. With hideLocale: 'never' there is no middleware rewriting prefix-less requests, no cookie-based locale, no cache ambiguity — the production build is a set of plain static pages.
  3. Honest SEO. hreflang alternates map one explicit URL to another; nothing is indexed under a path that silently varies.

The price is the chooser at /: one extra hop for the type-in visitor. That page is a real choice (two cards with descriptions and hreflang metadata), not a redirect guess — a reader coming back weekly picks once and bookmarks deep links thereafter.

The mirrored tree

Content uses the dir parser: content/docs/en/… and content/docs/zh/… with identical structures. Alternatives considered:

  • dot parser (page.zh.mdx beside page.mdx) — fine for a few localized files, but it scatters each page's two versions across the tree and makes "is zh complete?" a question you cannot answer by looking. The dir parser makes parity auditable with a diff of two file listings.
  • per-locale content roots with separate loaders — two sources to keep in sync for no gain at two locales.

The mirror is intentionally allowed to hold English placeholder text in zh: a complete, structurally valid tree that builds green is more useful than a half-translated tree whose dead links and diverging sidebars rot. Translation is then an incremental pass per page, never a structural migration.

Fallback semantics

The loader's fallback language is the default (en): a page missing in zh would show English content rather than 404. The mirror makes that safety net almost unused — it exists for the window between an English page landing and its zh copy.

UI strings are code, not content

Search, TOC, pagination, theme and language switcher labels are translated in one typed place (lib/layout.shared.tsx) rather than in each MDX page, because they are interface, not prose — and because Fumadocs' translation API keys them once and ships them to the client payload only.

On this page