Skip to content

v16.1.0

Choose a tag to compare

@adrai adrai released this 02 Sep 15:51
  • App Router: localeInPath: 'internal' — a third routing mode for clean URLs and static prerendering per locale. Routes stay under app/[lng]/, but the proxy rewrites /about to /{lng}/about internally (cookie → Accept-Language → fallback), so the public URL never shows a locale while every locale is still prerendered via generateStaticParams. Explicit locale paths (/de/about) are served as-is, never redirected, so <Link> prefetches cannot flip the language cookie; switch languages with useChangeLanguage(). This is the mode for Next.js Cache Components (cacheComponents: true), where localeInPath: false cannot be used because reading headers()/cookies() makes every route dynamic. #2345
  • App Router: getT() resolves the language from next/root-params first (Next.js 16.3+) — root params are part of the route key, so unlike headers()/cookies() they do not opt a route out of prerendering. await getT('home') in a prerendered [lng] route no longer needs { lng } threaded through every call site. Falls back to header/cookie detection on older Next.js, in Route Handlers and Server Actions (which have no root params), or when the root layout has no locale segment. #2345
  • App Router: languages load on demandgetT() now calls loadLanguages(lng) and checks hasLoadedNamespace(ns, { lng }) for the requested language instead of the instance's own. The default still preloads every supported language; set i18nextOptions: { preload: [] } to load each language on its first request, keeping memory proportional to the locales actually served. #2345
  • App Router: localeParamName option — name of the locale route segment (default 'lng'). generateI18nStaticParams() keys its params by it, so an app/[locale] segment now prerenders (previously the returned { lng } silently matched nothing); root-param detection uses the same name. generateI18nStaticParams<'locale'>() narrows the return type. #2345