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-i18nextimport now exports App Router utilities (defineConfig,normalizeConfig,I18nConfig). Pages Router users must update tonext-i18next/pages. - Removed
i18next-fs-backenddependency: Pages Router server-side loading now usesi18next-resources-to-backendwithfs.readFileSyncinternally. 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, andgenerateMetadata. 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 viauseprop.initServerI18next(config)— one-time server configuration setupgetResources(i18n, namespaces?)— extract loaded resources for client hydrationgenerateI18nStaticParams()— helper forgenerateStaticParams
- Proxy support (Next.js 16+) —
createProxy()fromnext-i18next/proxyfor the newproxy.tsfile convention.createMiddleware()fromnext-i18next/middlewareremains available for Next.js 14/15.- Edge-safe language detection (cookie → Accept-Language → fallback)
- Locale-in-path routing with automatic redirects
- Custom header for Server Component language detection
basePathoption — scope the proxy to a URL prefix (e.g.,/app-router) for mixed App Router + Pages Router setups- No-locale-path mode —
localeInPath: falsefor cookie-based language without URL prefixes. UseuseChangeLanguage()hook for language switching. defineConfig()— type-safe configuration helper- Custom backend support — pass any i18next backend plugin (http-backend, locize-backend, chained-backend) via the
useconfig option. The default resource loader is skipped automatically when a custom backend is provided. resourceLoaderoption — custom async loader function(lng, ns) => Promise<object>for dynamic imports or custom loading logic- Server-side singleton caching — translations loaded once and reused across requests. Custom backends benefit from this — no re-fetching per request.
nonExplicitSupportedLngs— match'en'to'en-US'etc. in language detection
Pages Router
- All existing v15 APIs preserved under
next-i18next/pagesandnext-i18next/pages/serverSideTranslations appWithTranslation,useTranslation,Trans,serverSideTranslations— unchanged behavior- Defensive
.filter(Boolean)onconfig.usearrays to handle CJS/ESM interop edge cases with Turbopack