Config options
The options of the next-i18next config, with their defaults.
The options of i18n.config.ts for the App Router:
supportedLngs(required): the language codes, for example['en', 'de'].fallbackLng(required): the default language.defaultNS(default'common'): the default namespace.ns(default[defaultNS]): all namespaces.localeInPath(defaulttrue):trueputs the language in the path (/en/about);falsegives addresses without it, with the language from the cookie or header (every route renders on request);'internal'gives addresses without it while the language segment stays in the internal rewrite, so routes still prerender.localeParamName(default'lng'): the name of the language route segment (app/[lng]), used bygenerateI18nStaticParamsand bygetT()to read the language from the root param.hideDefaultLocale(defaultfalse): withlocaleInPath: true, the default language has no prefix in the path.pathnames(no default): translated paths per language, for example{ '/contact': { de: '/kontakt' } }; see Translated paths.localePath(default'/locales'): the folder of the translation files, relative topublic.localeStructure(default'{{lng}}/{{ns}}'): the file layout insidelocalePath.localeExtension(default'json'): the file extension.resources(no default): translations passed in directly; nothing is loaded then.resourceLoader(no default): an async loader(lng, ns) => Promise<object>, used instead oflocalePath.basePath(no default): the route-folder prefix the proxy handles, for example'/app-router'forapp/app-router/[lng]/…in mixed-router setups. ThebasePathofnext.configneeds no setting here; the proxy handles it by itself.cookieName(default'i18next'): the name of the language cookie.headerName(default'x-i18next-current-language'): the header that passes the language to Server Components.cookieMaxAge(default31536000, one year): the lifetime of the cookie in seconds.persistCookie(defaulttrue): whether the proxy writes the language cookie;falsereads it but never writes it, for apps where another system owns the cookie.cookieOptions(default{}): more cookie attributes (domain,secure,sameSite,path,maxAge), applied on top of{ path: '/', maxAge: cookieMaxAge, sameSite: 'lax' }.ignoredPaths(default['/api', '/_next', '/static']): the paths the proxy skips.use(default[]): i18next plugins.i18nextOptions(default{}): more i18next init options.nonExplicitSupportedLngs(defaultfalse): lets'en'match'en-US'and other regional codes.reloadOnPrerender(default off): in development only, reloads the translations before each render; see In development.
Pages Router options
The options of next-i18next.config.js for the Pages Router, besides i18n (defaultLocale and locales, as in the Next.js config):
defaultNS(default'common'): the default namespace.localePath(default'./public/locales'): the folder with the translation files. It can also be a function(locale, namespace, missing) => paththat returns the path of one file (then list all namespaces inns;missingis alwaysfalse), ornullwhen you passresourcesyourself.localeStructure(default'{{lng}}/{{ns}}'): the file layout insidelocalePath. It follows a custominterpolation.prefixandsuffix(for example'{lng}/{ns}') unless you set it; ignored whenlocalePathis a function.localeExtension(default'json'): the file extension; ignored whenlocalePathis a function.reloadOnPrerender(defaultfalse): reloads the translations on everyserverSideTranslationscall, in development only; see Reloading in development.serializeConfig(defaulttrue): puts the config into the page props forappWithTranslation; see Unserializable configs.serverInstanceKey(no default): keeps one server-side i18next instance per key; see Multi-tenant setups.use(default[]): i18next plugins.onPreInitI18next(no default): called with the i18next instance beforeinit, for example(i18n) => i18n.on('failedLoading', handleFailedLoading).
All other i18next options and React options go into the same config.
serverSideTranslations reads the config from ./next-i18next.config.js unless you pass it. For another location, for example an app inside a monorepo, set the environment variable I18NEXT_DEFAULT_CONFIG_PATH, e.g. in next.config.js:
js
process.env.I18NEXT_DEFAULT_CONFIG_PATH = `${__dirname}/next-i18next.config.js`