|\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).",[3044],{"name":3019,"color":3020},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.69196385,{"description":3051,"labels":3052,"number":3054,"owner":3022,"repository":3023,"state":3024,"title":3055,"updated_at":3056,"url":3057,"score":3058},"### Environment\n\n- Operating System: Darwin\n- Node Version: v22.15.0\n- Nuxt Version: 3.17.3\n- CLI Version: 3.25.1\n- Nitro Version: 2.11.12\n- Package Manager: npm@10.9.2\n- Builder: -\n- User Config: compatibilityDate, devtools, modules, i18n, nitro\n- Runtime Modules: @nuxt/content@3.5.1, @nuxtjs/i18n@9.5.4\n- Build Modules: -\n\n\n### Reproduction\n\nA minimal reproduction of this issue can be found in the following repository: https://github.com/odan-sandbox/nuxt-content-and-i18n-no_prefix-example\n\n\n### Describe the bug\n\nWhen using the `no_prefix` strategy in `nuxt-i18n`, the locale detection based on the URL pathname is not functioning as expected. This results in incorrect locale assignment during SSR/SSG.\n\nFor example, accessing `/en/about` and `/ja/about` should render the corresponding locale-specific content, but instead, both paths are rendered using the default or server locale, ignoring the locale information in the pathname.\n\nThis issue causes problems for multilingual documentation sites using `nuxt/content`, where the content is structured by locale (e.g., `docs/en/about.md`, `docs/ja/about.md`). During SSG, both paths may be generated with the same language content, leading to incorrect output.\n\nIf a PR to resolve this issue is considered appropriate, I would be willing to work on it.\n\n\n### Additional context\n\nRelated: https://github.com/nuxt-modules/i18n/issues/3609\n\n### Logs\n\n```shell\n\n```",[3053],{"name":3019,"color":3020},3619,"Locale detection not working with `no_prefix` strategy","2025-05-19T06:13:27Z","https://github.com/nuxt-modules/i18n/issues/3619",0.69316715,{"description":3060,"labels":3061,"number":3065,"owner":3022,"repository":3023,"state":3066,"title":3067,"updated_at":3068,"url":3069,"score":3070},"### 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",[3062],{"name":3063,"color":3064},"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.6407859,{"description":3072,"labels":3073,"number":3081,"owner":3022,"repository":3023,"state":3066,"title":3082,"updated_at":3083,"url":3084,"score":3085},"### 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```",[3074,3075,3078],{"name":3063,"color":3064},{"name":3076,"color":3077},"scope: prerender","8B39DF",{"name":3079,"color":3080},"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.65371495,{"description":3087,"labels":3088,"number":3091,"owner":3022,"repository":3023,"state":3066,"title":3092,"updated_at":3093,"url":3094,"score":3095},"### Environment\n\n- Operating System: Windows 11\n- Node Version: 18.18.2\n- Nuxt Version: 3.15.0\n- @nuxtjs/i18n: 9.5.3\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-7rohnkcc?file=nuxt.config.ts\n\n### Describe the bug\n\nI am using the following configuration:\n\n```\ni18n: {\n locales: [ ... ],\n strategy: 'prefix_except_default',\n langDir: 'lang',\n lazy: true,\n defaultLocale: 'en',\n detectBrowserLanguage: {\n useCookie: true,\n cookieKey: 'i18n_redirected',\n fallbackLocale: 'en',\n redirectOn: 'no prefix',\n alwaysRedirect: true,\n }\n}\n```\n\nExpected:\nA Japanese user is on the link `https://www.xxx.com/ja/about`, now opening the following links should result in the following redirection behavior:\n`https://www.xxx.com/nl/about` → `https://www.xxx.com/nl/about`\n`https://www.xxx.com/about` → `https://www.xxx.com/ja/about`\n`https://www.xxx.com` → `https://www.xxx.com/ja`\n\nThis also matches the documentation:\n`'no prefix' - a more permissive variant of 'root' that will detect the browser locale on the root path ('/') and also on paths that have no locale prefix (like '/foo'). Only effective when using strategy other than 'no_prefix'.`\n\nActual behavior (only listing the problematic case):\n`https://www.xxx.com/nl/about` → `https://www.xxx.com/ja/about`\n\nThe above issue exists in versions v7, v8, and v9.\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3089,3090],{"name":3063,"color":3064},{"name":3079,"color":3080},3545,"The behavior of redirectOn set to 'no prefix' from version 7 to version 9 is inconsistent with the documentation.","2025-06-22T23:03:38Z","https://github.com/nuxt-modules/i18n/issues/3545",0.6584486,{"description":3097,"labels":3098,"number":3100,"owner":3022,"repository":3023,"state":3066,"title":3101,"updated_at":3102,"url":3103,"score":3104},"### 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_",[3099],{"name":3063,"color":3064},3126,"`detectBrowserLanguage` does not detect browser lang as expected","2025-06-08T01:24:47Z","https://github.com/nuxt-modules/i18n/issues/3126",0.67319554,{"description":3106,"labels":3107,"number":3109,"owner":3022,"repository":3023,"state":3066,"title":3110,"updated_at":3111,"url":3112,"score":3113},"### Environment\n\n- Operating System: Darwin\n- Node Version: v22.16.0\n- Nuxt Version: 3.17.7\n- CLI Version: 3.26.2\n- Nitro Version: 2.12.2\n- Package Manager: pnpm@10.13.1\n- Builder: -\n- User Config: compatibilityDate, future, devtools, telemetry, debug, runtimeConfig, app, css, postcss, tailwindcss, modules, cms, build, storefront, storefront-ui, svgo, fonts, image, experimental, i18n, opentelemetry, imports, vueuse, components, vue, devServer, ignore, routeRules, vite, hooks, nitro, optimization\n- Runtime Modules: @nuxtjs/i18n@10.0.0, @scayle/storefront-nuxt/module@8.33.2, @scayle/omnichannel-nuxt/module@4.3.2, @nuxtjs/tailwindcss@6.14.0, nuxt-svgo@4.2.4, @nuxt/fonts@0.11.4, @nuxt/image@1.10.0, @vueuse/nuxt@13.5.0, nuxt-swiper@1.2.2, @nuxt/test-utils/module@3.19.2, @nuxt/eslint@1.4.1, @scayle/eslint-auto-explicit-import@0.2.0, @scayle/nuxt-opentelemetry@0.13.10, @scayle/storefront-country-detection@2.0.0, @scayle/storefront-product-detail@1.5.0, @scayle/storefront-product-listing@2.0.1, @scayle/storefront-promotions@2.2.0, @scayle/storefront-search@0.3.0, @scayle/storefront-basket@0.3.0, @scayle/storefront-navigation@0.3.0, @scayle/nuxt-image-provider@0.3.1, @nuxtjs/storybook@8.4.1\n- Build Modules: -\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-a8x1bxda?file=i18n%2Fi18n.config.ts\n\n### Describe the bug\n\nI use a module that relies on the correct locale during SSR. When I set the strategy to `prefix` and open some site without prefix but with query params, the default locale is missing during SSR. \n\nIn my case, this cause the page to crash. \n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3108],{"name":3019,"color":3020},3733,"Redirects are not properly resolved when the URL contians query params","2025-07-19T09:16:15Z","https://github.com/nuxt-modules/i18n/issues/3733",0.67909116,{"description":3115,"labels":3116,"number":3119,"owner":3022,"repository":3023,"state":3066,"title":3120,"updated_at":3121,"url":3122,"score":3123},"## Bug Report\n\n### Description\nWhen using `strategy: 'prefix'`, the i18n module doesn't respect the URL prefix language when the browser sends an `accept-language` header.\n\n### Expected Behavior\nWhen accessing `/zh` path, the page should display in Chinese (zh) regardless of the `accept-language` header value.\n\n### Actual Behavior\nWhen accessing `/zh` path with `accept-language: en;zh-ch,q=0.9;kr,q=0.8`, the page displays in English (en) instead of Chinese (zh).\n\n### Configuration\n```typescript\n// nuxt.config.ts\nexport default defineNuxtConfig({\n modules: ['@nuxtjs/i18n'],\n i18n: {\n strategy: 'prefix',\n locales: [\n { code: 'zh', name: '中文' },\n { code: 'en', name: 'English' },\n { code: 'ja', name: '日本語' },\n { code: 'ko', name: '한국어' }\n ],\n defaultLocale: 'zh',\n detectBrowserLanguage: {\n useCookie: true,\n cookieKey: 'i18n_redirected',\n redirectOn: 'root'\n }\n }\n})\n```\n\n### Reproduction Steps\n1. Set up Nuxt project with above i18n configuration\n2. Create a simple page with locale-specific content\n3. Make request to `/zh` with specific accept-language header\n\n### cURL Example\n```bash\ncurl -H \"Accept-Language: en;zh-ch,q=0.9;kr,q=0.8\" http://localhost:3000/zh\n```\n\n### Expected Result\nPage should display in Chinese (zh) as specified by the URL prefix `/zh`.\n\n### Actual Result\nPage displays in English (en) as specified by the accept-language header priority.\n\n### Environment\n- Nuxt version: v4.0\n- @nuxtjs/i18n version: v10.0.2",[3117],{"name":3118,"color":3035},"need reproduction",3752,"Bug: strategy 'prefix' doesn't respect URL prefix when accept-language header is present","2025-07-23T10:21:05Z","https://github.com/nuxt-modules/i18n/issues/3752",0.6830601,["Reactive",3125],{},["Set"],["ShallowReactive",3128],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fs17_tEZm4PS9YnLTqgYbEsCrTzSSXPMLivzyMHPaLx8":-1},"/nuxt-modules/i18n/2507"]