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"| Field | Type | Default | Description |
default_locale | String | "en" | Default locale, served at root (no URL prefix) |
locales | String[] | [] | All configured locales |
translation_dir | String | "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:
- The default locale is built at the root URL (
/docs/...) - Other locales are built at
/{locale}/docs/...(e.g.,/ja/docs/...) - A locale switcher dropdown appears in the header
- Translation bundles are generated as JSON for client-side use
Supported Locales
Oxidoc provides display names for these locale codes:
| Code | Display Name | Code | Display Name |
en | English | ko | 한국어 |
es | Español | pt | Português |
ja | 日本語 | ru | Русский |
fr | Français | it | Italiano |
de | Deutsch | ar | العربية |
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.