How it works
The language is not part of the URL. i18n/request.ts reads the NEXT_LOCALE cookie, falls back to the default locale, and loads messages/<locale>.json. When the auth module is installed, users pick their language in Settings, Account.
Steps
- 1Add the localeList it in the routing config.i18n/routing.tsexport const routing = defineRouting({locales: ["en", "es", "fr", "de"],defaultLocale: "en",})
- 2Add the messagesCopy
messages/en.jsontomessages/de.jsonand translate the values. Keep the keys. - 3Name it in the language pickerWith the auth module, add a label for the new code to
LOCALE_LABELSincomponents/auth/account-language-form.tsx, for examplede: "Deutsch". The picker lists every locale fromrouting.locales. - 4Check itChoose the language in Settings, Account, or set the
NEXT_LOCALEcookie tode, and reload.