xyd 0.1.0-beta - Coming Soon

Writing Content
/
Internationalization

InternationalizationAlpha

Serve your documentation in multiple languages with locale-prefixed URLs, translated navigation, and a built-in locale switcher.

Quick Start

Declare your languages in docs.json under navigation.languages:

File Structure

The default locale lives at the root. Every other locale mirrors the tree under a folder named after its language code:

URLs

LocaleURL patternExample
Default
/<slug> (unprefixed)
/quickstart
Other
/<language>/<slug>
/pl/quickstart, /de/quickstart

Root / keeps its existing index behavior. The default locale never gets a prefix.

Translating Navigation

Each language can have its own navigation, sidebar, tabs, anchors, and so on. Build them the same way you build the regular navigation, just nested under the matching language entry.

If your navigation has the same structure in every language, you don't need to repeat the whole tree per locale. Define the structure once at navigation.sidebar, list the locales under navigation.languages, and let the strings come from translation catalogs:

When a language entry omits sidebar/tabs/anchors/etc., it inherits the field from the top-level navigation. Wrap any string in a catalog key ("i18n: <key>") to translate it per locale.

Translation Catalogs

Catalog is the translation reference system where definitions are not declared explicite at the property level. Thanks to that, managing bigger translations is much easier.

Sources

There are three ways to supply catalogs, in priority order:

Format

Both flat dot-keys and nested objects are accepted — and can coexist in the same file. Lookup tries the exact flat key first, then walks dot-segments through nested objects.

Per-Locale Overrides

If you need to override translations for a built-in structure like banner or footer add overrides:

i18nSettings

A top-level i18n is a global configuration for how internationalization behaves:

    defaultLocale
    string
    Explicit default locale. Overrides any `default: true` shorthand on `navigation.languages[]` entries when set. Must match a `language` declared in `navigation.languages[]` .
    detectLanguage
    boolean
    When `true` , redirect `/` based on `navigator.language` / `xyd-locale` cookie. Default `false` .
    catalogs
    Record<string, string | TranslationCatalog>
    Translation catalogs for `"i18n: <key>"` references in component config. Either a path to a JSON file, or an inline catalog object, keyed by locale code. If omitted, the framework auto-discovers `i18n/{language}.json` files at the project root.
Built with

Show your support! Star us on GitHub ⭐️