RegistryAdding a languageMenu

Adding a language

Every block is i18n-native. A new language is a folder of message files — no component changes.

Each block reads its copy through next-intl under a namespace named after the block, and ships messages/en/<block>.json. The scaffold’s i18n/request.ts merges every file in messages/<locale>/ by filename, so the namespace is the filename.

Add a locale

  1. Add it to i18n/routing.ts. The scaffold writes:

    i18n/routing.ts
    export const routing = defineRouting({
      locales: ["en"],
      defaultLocale: "en",
      // Locale prefix only appears in the URL when it isn't the default
      // locale (e.g. /dashboard, not /en/dashboard) — a single-locale
      // deployment needs nothing beyond this config and the shipped
      // English messages to work.
      localePrefix: "as-needed",
    });

    Add the locale to locales, for example ["en", "de"].

  2. Copy messages/en/ to messages/de/ and translate the values. Keep the keys. You can translate a namespace at a time: i18n/request.ts lays each locale over the default locale’s messages, so a file or key de does not have yet renders in English.

  3. Install the language-switcher block and put it in a shell slot:

    TSX
    // lib/shell-config.tsx
    export const shellConfig: ShellConfig = { headerRight: LanguageSwitcher };

A missing file or key renders in the default locale; messages/en stays the reference, and intelligo sync --check lists what a locale has not translated.

Your own strings

Add keys for your own routes to the relevant namespace — navigation labels go in messages/<locale>/app-shell.json, chat starters in chat.json — or add a new namespace file for a page of your own.

Blocks navigate through @/i18n/navigation, so links keep the active locale. Use the same helpers in your own pages instead of next/link.