|\u003Cimg width=\"324\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/cd6f6927-33b3-4b85-a984-64c6cb1f53e5\" />|\n\n#### Proposed Feature: `localeDetector` Option\n\n##### Current Behavior Example\n\nTo illustrate the current behavior, consider the following scenario:\n\n* Accessing `/en/about` and `/ja/about` under the `no_prefix` strategy will not trigger locale detection based on the pathname.\n* As a result, both paths will use the language setting of the build machine during SSG, resulting in both paths potentially being generated in the same language.\n\nScreenshots and repository links demonstrating the current behavior will be provided to further clarify the issue.\n\nTo address this issue, I propose adding a new `localeDetector` option to the module configuration. This option allows specifying the methods for locale detection as follows:\n\n```typescript\ntype LocaleDetector = (\"pathname\" | \"domain\" | \"cookie\" | \"browser\")[];\n\nconst localeDetector: LocaleDetector = [\"pathname\", \"domain\", \"cookie\", \"browser\"];\n```\n\nIf `pathname` is specified, the locale will be automatically detected based on the URL pathname.\n\nThe default value of `localeDetector` will vary depending on the `strategy` value to maintain backward compatibility. For instance, when `no_prefix` is selected, the default value would be:\n\n```javascript\nlocaleDetector: [\"domain\", \"cookie\", \"browser\"]\n```\n\n##### Example Configuration for My Use Case:\n\n```javascript\nstrategy: \"no_prefix\",\nlocaleDetector: [\"pathname\", \"cookie\", \"browser\"]\n```\n\nThis configuration would resolve the issue by enabling locale detection based on pathname while maintaining backward compatibility with existing behavior.\n\nThank you for considering this feature request. I would be happy to provide further clarifications or contribute to the implementation if needed.\n\n\n### Additional information\n\n- [x] Would you be willing to help implement this feature?\n- [ ] Could this feature be implemented as a module?\n\n### Final checks\n\n- [x] Read the [contribution guide](https://nuxt.com/docs/community/contribution) (The contribution guideline of nuxt-modules/i18n is compliant with Nuxt too).\n- [x] Check existing [discussions](https://github.com/nuxt-modules/i18n/discussions) and [issues](https://github.com/nuxt/nuxt/issues).",[3194],{"name":3173,"color":3174},3609,"Add `localeDetector` option to customize locale detection during Vue component rendering","2025-05-16T18:51:35Z","https://github.com/nuxt-modules/i18n/issues/3609",0.6499812,{"description":3201,"labels":3202,"number":3204,"owner":3176,"repository":3177,"state":3178,"title":3205,"updated_at":3206,"url":3207,"score":3208},"### Environment\n\n------------------------------\n- Operating System: Windows_NT\n- Node Version: v22.17.0\n- Nuxt Version: 4.1.2\n- CLI Version: 3.28.0\n- Nitro Version: 2.12.6\n- Package Manager: pnpm@9.15.9\n- Builder: -\n- User Config: compatibilityDate, devtools, typescript, runtimeConfig, imports, hooks, nitro, routeRules, modules, app, i18n, linkChecker, seo, site, robots, sitemap, ogImage, pwa, css, build, experimental, devServer, vite\n- Runtime Modules: @nuxt/eslint@1.9.0, @nuxtjs/i18n@10.1.0, @vueuse/nuxt@13.9.0, @nuxtjs/seo@3.1.0, @pinia/nuxt@0.11.2, ./modules/pwa-i18n, @vite-pwa/nuxt@1.0.4\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nNot sure about the reason. On StackBlitz, `npm i` throws the error `ERROR Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828)`. On CodeSandbox, it gets stuck at `Resuming MicroVM... Still booting, please wait`.\n\n### Describe the bug\n\nmy config: ssg\n\n```javascript\nstrategy: \"prefix_except_default\",\ndetectBrowserLanguage: {\n useCookie: true,\n cookieKey: \"app-locale\",\n redirectOn: \"root\",\n alwaysRedirect: false,\n},\n```\n\nI have a page that users can share via its link.\nTo prevent other users from being forced to switch languages when visiting this URL,\nI tried adding a query parameter and then checking for its presence in the `i18n:beforeLocaleSwitch` hook when the page is accessed.\nThe idea was to prioritize using the user’s existing cookie language to avoid forcing a language change.\n\nHowever, in my tests I found that when directly opening that URL, by the time this hook is triggered, the browser’s cookie has already been updated to the language from the URL, so I don’t have a chance to retrieve the user’s previously set language.\n\n---\n\n- In addition, if `redirectOn` could be configured as a function, wouldn’t it be much easier to implement my requirement?\n\n- The comment for the alwaysRedirect option in the code says: `Always redirect to the detected locale, not just on first visit`, which doesn’t match the documentation for [alwaysRedirect](https://i18n.nuxtjs.org/docs/api/options#alwaysredirect). This initially confused me about its relationship with `redirectOn: \"all\"`.\nMy current understanding is(is this right?):\n\n - alwaysRedirect: whether to always force a redirect to the language stored in the cookie.\n\n - redirectOn: under what circumstances to redirect to the language detected by detectBrowserLanguage (including the language in the route? and with the route language having higher priority?).\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3203],{"name":3173,"color":3174},3819,"cookie was modified before the i18n:beforeLocaleSwitch hook was triggered","2025-09-14T09:08:04Z","https://github.com/nuxt-modules/i18n/issues/3819",0.666621,{"description":3210,"labels":3211,"number":3213,"owner":3176,"repository":3177,"state":3178,"title":3214,"updated_at":3215,"url":3216,"score":3217},"### Environment\n\n```\n- Operating System: Darwin\n- Node Version: v22.18.0\n- Nuxt Version: 4.1.2\n- CLI Version: 3.28.0\n- Nitro Version: 2.12.6\n- Package Manager: npm@10.9.3\n- Builder: -\n- User Config: compatibilityDate, devtools, modules, ssr, i18n\n- Runtime Modules: @nuxtjs/i18n@10.1.0\n- Build Modules: -\n```\n\n### Reproduction\n\nhttps://github.com/invoxiagau/nuxt-18-detectBrowserLanguage\n\n- Run the production `cloud-build` and `cloud-run` scripts (check README), the bug is only occurring when serving static files\n- Set your browser default language as french\n\n### Describe the bug\n\n- Visit `localhost:8080`\n- I18n correctly detects the browser default language and redirects to `/fr`\n- You can see a list of links using different methods to localise links such as `NuxtLinkLocale`, `NuxtLink`+ `localePath`\n- The content is getting translated in french\n- But, the links are not getting updated:\n \nI expect: `/fr/generic-page`\nInstead I get: `/generic-page`\n\nI get the following error in my console:\n```Hydration completed but contains mismatches.```\n\n### Additional context\n\nI'm unable to reproduce this issue with the dev server, only after building and serving the static files using a http web server, in my case nginx.\n\n\n### Logs\n\n```shell\nHydration completed but contains mismatches.\n```",[3212],{"name":3173,"color":3174},3828,"localePath / NuxtLinkLocale hydration mismatches after browserRedirection with http web server","2025-09-29T08:39:16Z","https://github.com/nuxt-modules/i18n/issues/3828",0.6764274,{"description":3219,"labels":3220,"number":3224,"owner":3176,"repository":3177,"state":3225,"title":3226,"updated_at":3227,"url":3228,"score":3229},"### Environment\n\n- Operating System: Linux\r\n- Node Version: v18.20.3\r\n- Nuxt Version: 3.12.4\r\n- CLI Version: 3.12.0\r\n- Nitro Version: -\r\n- Package Manager: pnpm@8.15.6\r\n- Builder: -\r\n- User Config: modules, runtimeConfig, i18n, compatibilityDate\r\n- Runtime Modules: @nuxtjs/i18n@8.3.1\r\n- Build Modules: -\n\n### Reproduction\n\nhttps://stackblitz.com/edit/nuxt-starter-i18n-timothe?file=app.vue,pages/%5B...slug%5D.vue,nuxt.config.ts\n\n### Describe the bug\n\nWhen using `prefix_except_default` strategy, and try to initialize locale with setLocale function but I18n fallback to default locale afterward. It's only work when I set detectBrowserLanguage to `{}` instead of `false`.\n\n### Additional context\n\nI let the CMS handle the routing for the wildcard.\n\n### Logs\n\n```shell\nisSSG false\r\nuseCookie on setup false\r\ndefaultLocale on setup fr\r\ngetLocaleCookie { useCookie: false, cookieKey: false, localeCodes: [ 'fr', 'en' ] }\r\ndetectLocale: initialLocale - fr\r\ndetectLocale: (ssg, callType, firstAccess) - normal setup true\r\ndetectLocale: detectBrowserLanguage (browserLocale, stat, reason, from) - false unknown unknown\r\ndetectLocale: finaleLocale first (finaleLocale, strategy) - prefix_except_default\r\ndetectLocale: finaleLocale second (finaleLocale, detectBrowserLanguage) - false\r\ndetectLocale: finalLocale last (finalLocale, defaultLocale) - fr\r\ndetectLocale: finalLocale - fr\r\nfirst detect initial locale fr\r\n../assets/fr.json is loading ...\r\nloadMessage: (locale) - fr\r\nloadMessage: load { welcome:\r\n { type: 0,\r\n start: 0,\r\n end: 9,\r\n loc: { start: [Object], end: [Object], source: 'Bienvenue' },\r\n body:\r\n { type: 2, start: 0, end: 9, loc: [Object], items: [Array], static: 'Bienvenue' } } }\r\nfinal initial locale: fr\r\nlocale-changing middleware { fullPath: '/',\r\n hash: '',\r\n query: {},\r\n name: 'slug',\r\n path: '/',\r\n params: { slug: '' },\r\n matched:\r\n [ { path: '/:slug(.*)*',\r\n redirect: undefined,\r\n name: 'slug',\r\n meta: {},\r\n aliasOf: undefined,\r\n beforeEnter: undefined,\r\n props: [Object],\r\n children: [],\r\n instances: {},\r\n leaveGuards: Set(0) {},\r\n updateGuards: Set(0) {},\r\n enterCallbacks: {},\r\n components: [Object] } ],\r\n meta: {},\r\n redirectedFrom: undefined,\r\n href: '/' } { fullPath: '/',\r\n path: '/',\r\n query: {},\r\n hash: '',\r\n name: undefined,\r\n params: { slug: '' },\r\n matched:\r\n [ { path: '/:slug(.*)*',\r\n redirect: undefined,\r\n name: 'slug',\r\n meta: {},\r\n aliasOf: undefined,\r\n beforeEnter: undefined,\r\n props: [Object],\r\n children: [],\r\n instances: {},\r\n leaveGuards: Set(0) {},\r\n updateGuards: Set(0) {},\r\n enterCallbacks: {},\r\n components: [Object] } ],\r\n meta: {},\r\n redirectedFrom: undefined,\r\n href: '/' }\r\ngetLocaleCookie { useCookie: false, cookieKey: false, localeCodes: [ 'fr', 'en' ] }\r\ndetectLocale: initialLocale - fr\r\ndetectLocale: (ssg, callType, firstAccess) - normal routing true\r\ndetectLocale: detectBrowserLanguage (browserLocale, stat, reason, from) - false unknown unknown\r\ndetectLocale: finaleLocale first (finaleLocale, strategy) - prefix_except_default\r\ndetectLocale: finaleLocale second (finaleLocale, detectBrowserLanguage) - false\r\ndetectLocale: finalLocale last (finalLocale, defaultLocale) - fr\r\ndetectLocale: finalLocale - fr\r\ndetect locale fr\r\nlocaleSetup false\r\nsetLocale: new -> fr old -> fr initial -> false\r\ndetectRedirect: targetLocale -> fr\r\ndetectRedirect: route -> { to:\r\n { fullPath: '/',\r\n hash: '',\r\n query: {},\r\n name: 'slug',\r\n path: '/',\r\n params: { slug: '' },\r\n matched: [ [Object] ],\r\n meta: {},\r\n redirectedFrom: undefined,\r\n href: '/' },\r\n from:\r\n { fullPath: '/',\r\n path: '/',\r\n query: {},\r\n hash: '',\r\n name: undefined,\r\n params: { slug: '' },\r\n matched: [ [Object] ],\r\n meta: {},\r\n redirectedFrom: undefined,\r\n href: '/' } }\r\ndetectRedirect: calledWithRouting -> true \r\ndetectRedirect: calculate routePath -> /\r\nredirectPath on locale-changing middleware \r\nnavigate options 302 false false false\r\nnavigate isSSG false\r\nsetLocale: new -> en old -> fr initial -> true\r\n../assets/en.json is loading ...\r\nloadMessage: (locale) - en\r\nloadMessage: load { welcome:\r\n { type: 0,\r\n start: 0,\r\n end: 7,\r\n loc: { start: [Object], end: [Object], source: 'Welcome' },\r\n body: { type: 2, start: 0, end: 7, loc: [Object], items: [Array], static: 'Welcome' } } }\r\ndetectRedirect: targetLocale -> en\r\ndetectRedirect: route -> { to: {} }\r\ndetectRedirect: calledWithRouting -> false \r\ndetectRedirect: calculate routePath -> /\r\nredirectPath on setLocale \r\nnavigate options 302 false false true\r\nnavigate isSSG false\n```\n",[3221],{"name":3222,"color":3223},"scope: language detection","1B89B8",3039,"closed","DetectBrowserLanguage rollback to default locale when using `prefix_except_default`","2025-06-08T01:03:16Z","https://github.com/nuxt-modules/i18n/issues/3039",0.6282558,{"description":3231,"labels":3232,"number":3234,"owner":3176,"repository":3177,"state":3225,"title":3235,"updated_at":3236,"url":3237,"score":3238},"### Environment\n\n------------------------------\r\n- Operating System: Windows_NT\r\n- Node Version: v20.10.0\r\n- Nuxt Version: 3.13.2\r\n- CLI Version: 3.13.2\r\n- Nitro Version: 2.9.7\r\n- Package Manager: npm@10.2.3\r\n- Builder: -\r\n- User Config: compatibilityDate, devtools, modules, i18n\r\n- Runtime Modules: @nuxtjs/i18n@8.5.5\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\n[nuxt-i18n-BUG-REPRODUCE.zip](https://github.com/user-attachments/files/17109191/nuxt-i18n-BUG-REPRODUCE.zip)\r\n\n\n### Describe the bug\n\nwith setting:\r\n```ts\r\ni18n:{\r\n strategy: 'prefix',\r\n locales: ['zh', 'en'], \r\n detectBrowserLanguage: // \r\n\t{\r\n\t\tuseCookie: false, //set true or false, not influenced the result\r\n\t\tcookieKey: 'i18n_redirected',\r\n\t\tredirectOn: 'root' // recommended\r\n\t}\r\n }\r\n```\r\n\r\nWhen Browser request header has `accept-language: zh-CN,zh;q=0.9`\r\nExpect: redirect to `/zh/hello`\r\nBut has: `location: /en/hello`\r\n\r\nsame with [issues/1632](https://github.com/nuxt-modules/i18n/issues/1632)\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[3233],{"name":3222,"color":3223},3126,"`detectBrowserLanguage` does not detect browser lang as expected","2025-06-08T01:24:47Z","https://github.com/nuxt-modules/i18n/issues/3126",0.64630044,{"description":3240,"labels":3241,"number":3246,"owner":3176,"repository":3177,"state":3225,"title":3247,"updated_at":3248,"url":3249,"score":3250},"### Environment\n\n- Operating System: macOS Ventura 13\r\n- Node Version: v19.9.0\r\n- Nuxt Version: 3.7.3\r\n- Nitro Version: 2.6.3\r\n- Package Manager: pnpm@8.9.2\r\n- Builder: -\r\n- User Config: modules, i18n\r\n- Runtime Modules: @nuxtjs/i18n@8.0.0-rc.5\r\n- Build Modules: -\n\n### Reproduction\n\nhttps://i18n-test.designbydc.de/\r\nAuth: **bug** /// **i18n-test$**\r\n\r\n-----\r\n**Config:**\r\n```\r\n{\r\n...\r\ni18n: {\r\n defaultLocale: 'de',\r\n langDir: 'locales',\r\n lazy: true,\r\n locales: [\r\n {\r\n code: 'en',\r\n iso: 'en-GB',\r\n name: 'EN',\r\n file: 'en-GB.json'\r\n },\r\n {\r\n code: 'de',\r\n iso: 'de-DE',\r\n name: 'DE',\r\n file: 'de-DE.json'\r\n }\r\n ],\r\n compilation: {\r\n strictMessage: false\r\n }\r\n }\r\n}\r\n```\r\n-----\r\n**Dependencies:**\r\n```\r\n\"devDependencies\": {\r\n \"@nuxt/devtools\": \"latest\",\r\n \"@nuxtjs/i18n\": \"^v8.0.0-rc.5\",\r\n \"nuxt\": \"^3.7.3\",\r\n \"sass\": \"^1.68.0\",\r\n \"sass-loader\": \"^13.3.0\"\r\n },\r\n```\n\n### Describe the bug\n\nAfter pre-rendering pages by default i18n configuration with `nuxt generate`, the browser language detection not automatically redirect visitors to their preferred language on initial page load. \r\n\r\nTo reproduce it click on the language navigation so the default cookie **i18n_redirected** will be enabled. \r\n\r\nThe bug occurs if you click on EN and try to load the page without pathname \"/en\". After that the wrong language link in navigation is active and the content is only partially displayed correctly suitable for the selected language.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[3242,3243],{"name":3222,"color":3223},{"name":3244,"color":3245},"scope: prerender","8B39DF",2507,"Redirection to preferred language not works after pre-rendering pages","2025-06-09T22:33:59Z","https://github.com/nuxt-modules/i18n/issues/2507",0.65665466,{"description":3252,"labels":3253,"number":3255,"owner":3176,"repository":3177,"state":3225,"title":3256,"updated_at":3257,"url":3258,"score":3259},"### Environment\n\n------------------------------\n- Operating System: Linux\n- Node Version: v20.19.1\n- Nuxt Version: 4.0.0\n- CLI Version: 3.26.3\n- Nitro Version: 2.12.0\n- Package Manager: pnpm@8.15.6\n- Builder: -\n- User Config: modules, devtools, i18n\n- Runtime Modules: @nuxtjs/i18n@10.0.1\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-zx2czsy7?file=nuxt.config.ts\n\n### Describe the bug\n\nWhen employing the prefix strategy, navigating to a page without a locale prefix (e.g., localhost:3000/test-page instead of localhost:3000/en/test-page) results in an HTTP 404 (Not Found) error. While the client-side URL subsequently updates to include the correct prefix, the server fails to issue a redirect.\n\nThe server should respond with a redirect to the prefixed URL, similar to how it handles redirects for the root path.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3254],{"name":3173,"color":3174},3741,"Redirect to fallback local missing paths other then the root path","2025-07-21T08:40:29Z","https://github.com/nuxt-modules/i18n/issues/3741",0.658928,{"description":3261,"labels":3262,"number":3268,"owner":3176,"repository":3177,"state":3225,"title":3269,"updated_at":3270,"url":3271,"score":3272},"### Environment\n\n- Operating System: Linux\n- Node Version: v22.11.0\n- Nuxt Version: 3.14.1592\n- CLI Version: 3.15.0\n- Nitro Version: 2.10.4\n- Package Manager: pnpm@9.13.1\n- Builder: -\n- User Config: default\n- Runtime Modules: @nuxtjs/i18n@9.1.0\n- Build Modules: -\n\n### Reproduction\n\nrepo: https://github.com/stefanprobst/issue-nuxt-i18n\n\n- clone repo\n- run `pnpm install`\n- run `pnpm build`\n- run `pnpm start`\n- run `curl http://localhost:3000 -H \"accept-language: de\" -i`\n\nresponse is:\n\n```\nHTTP/1.1 200 OK\nContent-Type: text/html; charset=utf-8\nETag: \"59-nAI7AXwKU+EgdRxYLxAT3Q7a2bE\"\nLast-Modified: Wed, 20 Nov 2024 19:51:43 GMT\nContent-Length: 89\nDate: Wed, 20 Nov 2024 19:51:53 GMT\nConnection: keep-alive\nKeep-Alive: timeout=5\n\n\u003C!DOCTYPE html>\u003Chtml>\u003Chead>\u003Cmeta http-equiv=\"refresh\" content=\"0; url=/en\">\u003C/head>\u003C/html>\n```\n\n---\n\nwith `@nuxtjs/i18n` version 9.0.0-rc-2 the response is (you can check out the \"rc2\" branch in the above repository):\n\n```\nHTTP/1.1 302 Found\nset-cookie: i18n_redirected=de; Path=/; Expires=Thu, 20 Nov 2025 19:53:45 GMT; SameSite=Lax\nlocation: /de\ncontent-type: text/html\nDate: Wed, 20 Nov 2024 19:53:45 GMT\nConnection: keep-alive\nKeep-Alive: timeout=5\nContent-Length: 89\n\n\u003C!DOCTYPE html>\u003Chtml>\u003Chead>\u003Cmeta http-equiv=\"refresh\" content=\"0; url=/de\">\u003C/head>\u003C/html>\n```\n\n### Describe the bug\n\nwhile version 9.0.0-rc.2 correctly redirects `/` to `/de` when the `accept-language` header is set to `de`, with version 9.0.0 and 9.1.0 i am redirected to `/en` (which is the default locale)\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3263,3264,3265],{"name":3222,"color":3223},{"name":3244,"color":3245},{"name":3266,"color":3267},"possible regression","B78041",3240,"[regression] incorrect root redirect on prerendered page (was working fine with v9.0.0-rc.2)","2025-06-22T23:03:37Z","https://github.com/nuxt-modules/i18n/issues/3240",0.66493887,["Reactive",3274],{},["Set"],["ShallowReactive",3277],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fFyKvxm0NnbnxCKgkRXQbT0nONyR-UKa5vbxlyTXXScI":-1},"/nuxt-modules/i18n/3545"]