Internationalization
Red Glare ships i18n scaffolding: a defaultLocale, a locales registry, a i18n.lang frontmatter field, and a language switcher in the header. UI strings (sidebar labels, "Edit this page", search placeholder, etc.) are translated for supported locales.
Current support
en) and Spanish (es). Additional locales can be declared — pages render correctly — but UI chrome falls back to English until the package adds strings for your locale.defaultLocale
Type: string · Default: 'en'
The default language of the site. Pages without a i18n.lang frontmatter value are assumed to be in this locale. The <html lang="..."> attribute on those pages is set from here.
redGlare({
defaultLocale: 'en',
})locales
Type: Record<string, { label: string }> · Optional
Registers additional locales. The key is the locale code (ISO 639-1 like en, es, fr — or with region, en-US, pt-BR). The value's label is the display string shown in the language switcher.
redGlare({
defaultLocale: 'en',
locales: {
en: { label: 'English' },
es: { label: 'Español' },
},
})The default locale should be declared in locales too so it appears in the switcher.
Per-page i18n.lang
In each page's frontmatter, set i18n.lang to the page's locale:
i18n:
lang: esThe route's <html lang> is set from this value. Pages without a lang fall back to defaultLocale.
Language switcher
When two or more locales are configured, the header renders a dropdown language switcher. Clicking a locale navigates to the equivalent page in that language.
"Equivalent page" is resolved by convention — the switcher expects parallel file paths per locale, e.g.:
src/content/docs/
├── en/
│ └── guides/setup.md
└── es/
└── guides/setup.mdThe switcher swaps the locale prefix in the path when the user picks a language.
What's translated today
UI strings that ship with the integration:
| String | en | es |
|---|---|---|
| "Edit this page" | Edit this page | Editar esta página |
| "On this page" | On this page | En esta página |
| "Search" | Search | Buscar |
| "Previous" / "Next" | Previous / Next | Anterior / Siguiente |
| "Skip to main content" | Skip to main content | Saltar al contenido principal |
Content itself is not translated automatically — you author each locale's markdown independently.
Not yet supported
- Automatic locale routing fallback (serving
/es/foo/with the English page when Spanish is missing). - Right-to-left layout.
- Pluralization rules in UI strings.
Filing these as feature requests is welcome. For now, author each locale's page tree in parallel and the rest of the chrome takes care of itself.