Internationalization

Content directory convention

The default locale always occupies the contentDir root (no route prefix); other locales put their content in <contentDir>/<key>/, and their routes get the corresponding prefix. Config:

ts
defineSiteConfig({
  locales: {
    en: { lang: 'en', label: 'English' },
  },
});

This site follows exactly that convention: docs/content/ is Simplified Chinese (the default), and docs/content/en/ is the English site — a full mirror of the Chinese structure (en/guide/, with the design subsection at en/guide/design/). You are reading the English mirror now:

Rule details:

UI text

UI strings live in src/shared/i18n/; zh is the shape source of truth and en must be structurally identical, with key validation at build time. Each locale's UI text is matched by prefix against its lang (en-US → English); unregistered languages fall back to Chinese — so a default locale only needs lang: 'en' to get an English site chrome. The UI text of islands such as comments (Giscus) and the password gate uses the same table.

Switcher

The navbar provides a locale switcher showing each locale's label. Switching navigates to the current page's corresponding route in the target locale.

Recommendations