- App Router: translated paths - new
pathnamesoption: withlocaleInPath: true,{ '/contact': { de: '/kontakt' } }serves/de/kontaktfromapp/[lng]/contact, redirects/de/contactto/de/kontakt, and redirects a path without locale straight to the translated path of the detected language.[param]and[...param]segments are supported (static routes match first, andcreateProxythrows when the two sides of an entry use different params), encoded paths andtrailingSlashwork, and withhideDefaultLocalethe default language's translated paths work without prefix. New helpersgetLocalizedPathandgetInternalPathfromnext-i18nextbuild links, the language switcher and hreflang alternates. New README section "Translated Paths". (#1381) - Pages Router:
serverInstanceKeyfor one server instance per tenant -serverSideTranslationskeeps one i18next instance per server process: the first call creates it with that call's backend options, later calls reuse it and the namespaces it has loaded. A config built per request (a tenant header for the translation API, say) therefore only counted on the first request after a start, and every tenant got the translations of that first one. WithserverInstanceKeyin the config passed toserverSideTranslations(the tenant, for example), next-i18next keeps one instance per key, each created with the backend options of the first call with that key. Keys must come from a known set: each instance and its backend's reload timer live until the server stops. Without the option nothing changes. - Docs: multi-tenant setups - new README section "Multi-tenant Setups":
serverInstanceKeyfor the Pages Router, and for the App Router onecreateServerI18nextper known tenant, kept across requests. (#2245, #2252, #2278) - App Router: no redirect loop with
hideDefaultLocaleon Next.js 16.3 - Next.js runs the proxy again for the target of a rewrite.hideDefaultLocalerewrites/aboutto/en/about, and that second run redirected/en/aboutback to/about, so every page of the default language ended in a redirect loop innext start(/too). The proxy now marks its rewrites with anx-i18next-rewrittenrequest header and serves such a request as is. The same applies to the new translated paths. - Pages Router: a config file written as an ES module is used - in a project with
"type": "module",next-i18next.config.jsexports the config withexport default.serverSideTranslationsloads that file withrequire(), which on current Node versions returns the module namespace ({ __esModule, default }) instead of the config. The server then ignored the config (defaultLocaleand everything else), and withserializeConfig(the default)appWithTranslationthrew "appWithTranslation was called without config.i18n" in the browser. The default export is now used. (#2256) - Docs: TROUBLESHOOT.md uses the v16 imports - "How to explicitly pass the config" imported from
next-i18nextandnext-i18next/serverSideTranslations, which v16 no longer exports; it now usesnext-i18next/pagesandnext-i18next/pages/serverSideTranslations. The unusedserverSideTranslations.jsshim from v15 in the repository root is removed (it was not part of the package). - Pages Router: no default
addPathany more, andsaveMissingis documented - since 16.0.0 the built-in loader that replaced i18next-fs-backend only reads the locale files, sosaveMissing: truesaved nothing and no.missing.jsonwas written (16.0.0 said the loader behaves the same; it does not for missing keys). The config still set anaddPath(….missing.json) that nothing used; it is gone, so a functionlocalePathis only called withmissing: false. New README section "Missing keys (saveMissing)": add a backend that can save, in the browser, such as i18next-http-backend with anaddPathto your own API route, or i18next-locize-backend. (#1921) - Docs: the Pages Router sections are back in the README - the v16 README had dropped them: fallback locales, unserializable configs, fallback SSG pages, client-side loading over HTTP, reloading in development, an options table (
localePath,localeStructure,serializeConfig,serverInstanceKey, ...),I18NEXT_DEFAULT_CONFIG_PATH, and notes for Vercel and Netlify and for Docker, all checked against v16. The restored sections have their v15 headings again, so existing links to them work. Thepages-router-simpleandpages-router-auto-static-optimizeexamples no longer mention the removedstrictModeoption and link the new options table.