Locales
Ship documentation in multiple languages with per-page fallbacks.
Locales
Localization is two things: a few lines in docs.json, and a translations
folder that mirrors your default content.
Configure
{
"i18n": {
"locales": ["en", "es"],
"default": "en",
"fallback": "show-default-with-banner"
}
}The default locale serves at unprefixed URLs (/payments/guides); every
other locale is prefixed (/es/payments/guides). Visiting a default-locale
URL with the prefix redirects to the canonical unprefixed form.
Translate
Translations live in a locale subfolder that mirrors the default tree — translate page by page, in any order:
content/docs/
├── payments/guides/quickstart.mdx ← en (default)
└── es/payments/guides/quickstart.mdx ← esThere is no required completeness: in the meantime, an untranslated page shows the default-locale content with a banner offering the default language — readers always find the content, never a gap in the navigation.
Generated API endpoint pages are shared across locales (specs are a single source); your hand-written intro pages in an API section translate like any other page.
Polish
{
"i18n": {
"locales": ["en", "pt-BR"],
"default": "en",
"localeLabels": { "pt-BR": "Português" },
"translations": { "pt-BR": { "search.placeholder": "Pesquisar..." } },
"searchLanguages": { "pt-BR": "portuguese" }
}
}localeLabelsnames entries in the language switcher (unlisted codes display uppercased, e.g. "ES").translationsoverrides any built-in UI string — navigation labels, search placeholder, version notices, fallback banner — per locale. English fills any key you don't override.searchLanguagessets the search stemmer where a locale's ISO code isn't auto-mapped.
Keep SEO honest while a translation is in progress: add the locale prefix
to seo.noindex (e.g. "/es") until it's ready for search engines.