Tiramisu Docs

Configuration

Internationalization

Set up multi-language documentation with locale folders, URL routing, fallback behavior, and a locale switcher.

Internationalization (i18n)

Tiramisu Docs supports multiple languages out of the box. Each locale gets its own folder, and the framework handles routing, fallback, and locale switching.

Configuration

Add an i18n block to your config:

typescript
i18n: {
  defaultLocale: "en",
  locales: [
    { code: "en", label: "English", flag: "πŸ‡¬πŸ‡§" },
    { code: "fr", label: "FranΓ§ais", flag: "πŸ‡«πŸ‡·" },
    { code: "de", label: "Deutsch", flag: "πŸ‡©πŸ‡ͺ" },
  ],
},

Folder Structure

Each locale has its own folder inside src/docs/:

src/docs
en
getting-started.tiramisu
guide.tiramisu
fr
getting-started.tiramisu
guide.tiramisu
de
getting-started.tiramisu

Each folder (en, fr, de) corresponds to a locale code from your config.

URL Structure

Pages are served under their locale prefix:

  • /docs/getting-started β€” English version
  • /docs/fr/getting-started β€” French version
  • /docs/de/getting-started β€” German version

Fallback Behavior

If a page doesn't exist in the selected locale, Tiramisu Docs falls back to the default locale and shows a banner indicating the page is not available in the selected language.

Locale Switcher

When multiple locales are configured, a locale switcher appears in the sidebar. Users can switch languages and the framework navigates to the equivalent page in the selected locale.