Getting started

Install one i18n definition and let the URL choose the locale.

The source locale stays unprefixed. Secondary locales live under /es and /uk, and their catalogs are loaded only when a visitor asks for them.

Define the catalog once

Import the source catalog statically for typed keys and fallback. Keep secondary catalogs behind dynamic imports so they are split from the first bundle.

export const i18n = defineI18n({
  locales: ['en', 'es', 'uk'],
  sourceLocale: 'en',
  source: en,
  loaders: {
    es: () => import('./es.json'),
    uk: () => import('./uk.json')
  }
});

Localized routes

/docs is English, /es/docs is Spanish and /uk/docs is Ukrainian. Switching language preserves the page, query string and fragment.

Source fallback

This sentence exists only in the source catalog, so Spanish and Ukrainian fall back to it.

MessageFormat 2

1 production behavior is covered.

3 production behaviors are covered.

12 production behaviors are covered.