i18next/next-i18next
The easiest way to translate your NextJs apps.
30 Releases
Latest: 4w ago
v16.0.7Latest
📋 Changes
- Pages Router: fix duplicate `i18next` in client bundles — v16 shipped the Pages Router as CJS-only, which forced bundlers to load `i18next` via its `require` condition (`i18next/dist/cjs`) while user code loaded it via the `import` condition (`i18next/dist/esm`), producing two copies of i18next in the same bundle. The Pages Router now builds dual ESM + CJS outputs, and the `./pages` and `./pages/serverSideTranslations` exports declare matching `import`/`require` conditions. The server-only filesystem branch of `createConfig` has been extracted into a separate `serverSideConfig` module (injected via hook by `serverSideTranslations`) so `createConfig` no longer pulls Node built-ins into client bundles. Note: `appWithTranslation` no longer re-runs the server-side validation/preload during SSR — that work happens once, up-front, inside `serverSideTranslations` (in practice a no-op since `appWithTranslation` uses the browser client with pre-loaded resources). [#2342](https://github.com/i18next/next-i18next/issues/2342)
v16.0.6
📋 Changes
- Pages Router: `reloadOnPrerender` now actually reloads — the option was previously calling `reloadResources()` on the browser-side i18next instance returned by `appWithTranslation` (which has no FS backend and is often `null` during `getStaticProps`/`getServerSideProps`). It now reloads on the disk-backed node-side instance, scoped to exactly the locales × namespaces being shipped, so edits to locale files appear without restarting `next dev`. Gated behind `NODE_ENV !== 'production'` to keep custom HTTP/locize/chained backends from being refetched on every prerender call. [#2123](https://github.com/i18next/next-i18next/issues/2123)
- App Router: `reloadOnPrerender` is now wired up — previously declared in the config types but never consumed. Same dev-only semantics as Pages Router: refetches translations from the configured backend (default FS or `use`-provided custom backend) before each render in development, deduplicated across `getT` calls within a single render via React's `cache()`. No effect in production builds. Note: when using a dynamic `import()`-based `resourceLoader`, hot-reload is bundler-dependent and may stall after the first edit because Turbopack/Webpack cache resolved JSON modules across HMR cycles — see the README "Dev tip" for the dev/prod-split pattern that gives full hot-reload.
v16.0.5
📋 Changes
- Pages Router: export missing types from `next-i18next/pages` — `TFunction`, `I18n`, `WithTranslation`, `WithTranslationHocType`, and `UseTranslation` types are now properly re-exported, matching the v15 API surface [#2339](https://github.com/i18next/next-i18next/issues/2339)
v16.0.4
📋 Changes
- TypeScript compatibility with i18next v26 — fixed type error in Pages Router `createConfig` where i18next v26's readonly `preload` type was incompatible with the internal config type
v16.0.3
📋 Changes
- New `hideDefaultLocale` option (App Router) — when enabled, the default language is served without a URL prefix (`/about` instead of `/en/about`). Non-default locales keep their prefix (`/de/about`). Explicit default-locale paths (`/en/about`) are automatically redirected to the clean URL. Works with `basePath` too. [#2338](https://github.com/i18next/next-i18next/issues/2338)
v16.0.2
📋 Changes
- Serverless/Vercel: better error when `public/locales/` is not available at runtime — the default filesystem backend now catches read failures and shows a clear error message explaining the serverless limitation with a `resourceLoader` code example [#2337](https://github.com/i18next/next-i18next/issues/2337)
- `partialBundledLanguages` + `resources` — when both `resources` and `partialBundledLanguages: true` are provided, the default backend is now correctly kept so it can load additional namespaces not included in the pre-loaded resources
v16.0.1
📋 Changes
- App Router: `config.resources` now works on the server — `resources` was typed and documented but ignored at runtime by `initServerI18next` / `getT`. The resource backend is now skipped when `resources` is provided, and the pre-loaded translations are passed directly to `i18next.init()`. [#2336](https://github.com/i18next/next-i18next/issues/2336)
v16.0.0
💥 BREAKING CHANGES
- Import paths changed for Pages Router: `next-i18next` → `next-i18next/pages`, `next-i18next/serverSideTranslations` → `next-i18next/pages/serverSideTranslations`
- Root export is now App Router: The default `next-i18next` import now exports App Router utilities (`defineConfig`, `normalizeConfig`, `I18nConfig`). Pages Router users must update to `next-i18next/pages`.
- Removed `i18next-fs-backend` dependency: Pages Router server-side loading now uses `i18next-resources-to-backend` with `fs.readFileSync` internally. No change needed for users — the behavior is identical.
✨ New Features
- App Router support — first-class support for Next.js App Router with Server Components and Client Components
- `getT(ns?, options?)` — async translation function for Server Components, layouts, and `generateMetadata`. Returns namespace-typed `{ t, i18n, lng }`.
- `useT(ns?, options?)` — translation hook for Client Components. Reads language from `[lng]` or `[locale]` URL params automatically.
- `I18nProvider` — client-side provider for hydrating server-loaded translations. Supports custom backends via `use` prop.
- `initServerI18next(config)` — one-time server configuration setup
- `getResources(i18n, namespaces?)` — extract loaded resources for client hydration
- `generateI18nStaticParams()` — helper for `generateStaticParams`
- Proxy support (Next.js 16+) — `createProxy()` from `next-i18next/proxy` for the new `proxy.ts` file convention. `createMiddleware()` from `next-i18next/middleware` remains available for Next.js 14/15.
- + 10 more
📦 Pages Router
- All existing v15 APIs preserved under `next-i18next/pages` and `next-i18next/pages/serverSideTranslations`
- `appWithTranslation`, `useTranslation`, `Trans`, `serverSideTranslations` — unchanged behavior
- Defensive `.filter(Boolean)` on `config.use` arrays to handle CJS/ESM interop edge cases with Turbopack
v15.4.3
📋 Changes
- types: fix: WithTranslation type from next-i18next is not generic (TS error) [#2329](https://github.com/i18next/next-i18next/issues/2329)
v15.4.2
📋 Changes
- types: re-add @types/hoist-non-react-statics to dependencies [#2316](https://github.com/i18next/next-i18next/pull/2316)
v15.4.1
📋 Changes
- Move @types/hoist-non-react-statics to devDependencies [#2310](https://github.com/i18next/next-i18next/pull/2310)
v15.4.0
📋 Changes
- support i18next v24
v15.3.1
📋 Changes
- update some i18next dependencies to address [#2288](https://github.com/i18next/next-i18next/issues/2288)
v15.3.0
📋 Changes
- Only overwrite ns config if it provided [#2270](https://github.com/i18next/next-i18next/pull/2270)
v15.2.0
📋 Changes
- add possibility to pass resources directly via config and set localePath to null
v15.1.2
📋 Changes
- fix: Install error with react-i18next v14 [#2248](https://github.com/i18next/next-i18next/issues/2248)
v15.1.1
📋 Changes
- optimize/fix last change for turbo
v15.1.0
📋 Changes
- try to fix for turbo [#2222](https://github.com/i18next/next-i18next/issues/2222)
v15.0.0
📋 Changes
- refactor: reuse existing i18next instance [#2226](https://github.com/i18next/next-i18next/pull/2226) -> If you use client side pages (not lazy loading translations), like described [here](https://github.com/i18next/i18next-http-backend/tree/master/example/next#4-setup-your-client-rendered-pagescomponents), make sure you set the partialBundledLanguages option to true, like [here](https://github.com/i18next/i18next-http-backend/tree/master/example/next#4-setup-your-client-rendered-pagescomponents).
v14.0.3
📋 Changes
- fix: correct namespacesRequired type in serverSideTranslations [#2203](https://github.com/i18next/next-i18next/pull/2201)
v14.0.2
📋 Changes
- try to fix namespacesRequired in serverSideTranslations is not type-safe anymore [#2201](https://github.com/i18next/next-i18next/issues/2201)
v14.0.1
📋 Changes
- try to fix namespacesRequired in serverSideTranslations is not type-safe anymore [#2201](https://github.com/i18next/next-i18next/issues/2201)
v14.0.0
📋 Changes
- requires i18next >= v23.0.1
- requires react-i18next >= v13.0.0
v13.3.0
📋 Changes
- using a custom backend on server side should also lazy load the passed namespaces
v13.2.2
📋 Changes
- pageProps may be undefined on strange setups [#2109](https://github.com/i18next/next-i18next/issues/2109)"
v13.2.1
📋 Changes
- types: fix serverSideTranslations args [#2104](https://github.com/i18next/next-i18next/pull/2104)"
v13.2.0
📋 Changes
- types: Update serverSideTranslation args type [#2097](https://github.com/i18next/next-i18next/pull/2097)"
v13.1.6
📋 Changes
- fix: allow user provided affixes to be used without providing localeStructure [#2100](https://github.com/i18next/next-i18next/pull/2100)"
v13.1.5
📋 Changes
- [#2089](https://github.com/i18next/next-i18next/pull/2089), more stable impelementation of "feat(server-side): custom default config path [#2084](https://github.com/i18next/next-i18next/pull/2084)"
v13.1.4
📋 Changes
- revert #2084
