Internationalization (i18n)

Oxidoc supports multi-locale documentation with a built-in locale switcher.

Configuration

oxidoc.tomltoml
[i18n]
default_locale = "en"
locales = ["en", "ja", "es", "fr"]
translation_dir = "i18n"
FieldTypeDefaultDescription
default_localeString"en"Default locale, served at root (no URL prefix)
localesString[][]All configured locales
translation_dirString"i18n"Directory for translation files

i18n is enabled automatically when more than one locale is configured.

Translation Files

Oxidoc uses Project Fluent (.ftl files) for translations. Create one file per locale in your translation directory:

i18n/
├── en.ftl
├── ja.ftl
├── es.ftl
└── fr.ftl

Each .ftl file contains key-value translation messages:

i18n/en.ftlftl
welcome = Welcome to the docs
getting-started = Getting Started
search-placeholder = Search documentation...
i18n/ja.ftlftl
welcome = ドキュメントへようこそ
getting-started = はじめに
search-placeholder = ドキュメントを検索...

How It Works

When you build with multiple locales:

  1. The default locale is built at the root URL (/docs/...)
  2. Other locales are built at /{locale}/docs/... (e.g., /ja/docs/...)
  3. A locale switcher dropdown appears in the header
  4. Translation bundles are generated as JSON for client-side use

Supported Locales

Oxidoc provides display names for these locale codes:

CodeDisplay NameCodeDisplay Name
enEnglishko한국어
esEspañolptPortuguês
ja日本語ruРусский
frFrançaisitItaliano
deDeutscharالعربية
zh中文hiहिन्दी

Additional supported codes: tr, pl, vi, th, nl, sv, da, fi, no, cs, hu, ro, el, he, uk.

Per-Locale Content

For locale-specific content pages, create parallel directory structures:

docs/
├── intro.rdx          # Default locale content
└── ja/
    └── intro.rdx      # Japanese content

If a translated page doesn't exist, the default locale content is used.

View page sourceLast updated on Mar 17, 2026 by Farhan Syah