Frameworks

React / Next.js

Your messages come from one directory — messages, public/locales, locales, src/i18n, src/locales or i18n, first match wins — unless next.config names one, which next-intl and next-translate both do. Both layouts are read: namespaced (messages/en/common.json, locale codes from the subdirectory names) and flat (locales/en.json, codes from the file names). Where both are present, namespaced wins.

The default locale is taken from next-intl's routing.{ts,js}, next-translate's i18n.{js,ts,mjs}, or the Pages Router i18n block in next.config, in that order. The locale list still comes from the directory, so a locale declared in routing but absent from messages/ is not invented.

A layer is a scoped locale directory — a Nuxt layer, a workspace package, a shared UI library, or one app in a monorepo. A React project resolves as a single layer named root.

Overrides

What you wantHow
Set the default localedefaultLocale — wins over every derived source
Restrict or reorder localeslocales
Force this adapterframework: 'react'
Name the directories yourself, or split them into layerslocaleDirs + defaultLocale, which hands the project to the generic adapter
i18n-kit.config.ts
import { defineI18nKitConfig } from '@the-i18n-kit/cli/config'

export default defineI18nKitConfig({
  defaultLocale: 'en',
})
When nothing declares a default locale and none is configured, the fallback is the first locale code in sorted order — the alphabet, not a decision, and silent. Declare defaultLocale.

Limits

  • A next.config.js wrapped in withNextIntl(...) or withSentryConfig(...) may fail to execute, since those wrappers need their packages installed and their environment present. The CLI warns naming the file and falls back to the directories above, so check the warning if the wrong directory turns up.
  • Only one locale directory is used. A project keeping messages in two places needs the generic adapter.
  • A routing file declaring neither locales nor defaultLocale is skipped in favor of the next source.
Copyright © 2026