|\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.66512275,{"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: `v21.7.1`\n- Nuxt Version: `3.16.2`\n- CLI Version: `3.25.0`\n- Nitro Version: `2.11.9`\n- Package Manager: `npm@10.9.0`\n- Builder: `-`\n- User Config: `codegen`, `compatibilityDate`, `css`, `device`, `devtools`, `i18n`, `image`, `modules`, `runtimeConfig`, `scripts`, `srcDir`, `svgo`, `vite`, `watch`\n- Runtime Modules: `@bootstrap-vue-next/nuxt@0.29.3`, `@nuxt/eslint@1.3.0`, `@nuxt/fonts@0.11.2`, `@nuxt/image@1.10.0`, `@nuxt/scripts@0.11.6`, `@nuxtjs/device@3.2.4`, `@nuxtjs/i18n@9.5.3`, `@nuxtjs/stylelint-module@5.2.1`, `nuxt-svgo@4.0.19`, `nuxt-swiper@2.0.0`\n- Build Modules: `-`\n\n\n### Reproduction\n\nHere is the reproduction:\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-rskcxctd\n\n### Describe the bug\n\nWhen you translate your pages with defineI18nRoute (or maybe into `pages` key into i18n config) is getting rid when strategy in no prefixed (bot _no_prefix_ and _prefix_except_default_)\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3053],{"name":3019,"color":3020},3598,"defineI18nRoute is not working with no_prefix strategy","2025-05-13T14:21:14Z","https://github.com/nuxt-modules/i18n/issues/3598",0.6822588,{"description":3060,"labels":3061,"number":3063,"owner":3022,"repository":3023,"state":3024,"title":3064,"updated_at":3065,"url":3066,"score":3067},"### Environment\n\n------------------------------\n- Operating System: Windows_NT\n- Node Version: v19.9.0\n- Nuxt Version: 3.17.3\n- CLI Version: 3.25.1\n- Nitro Version: 2.11.12\n- Package Manager: npm@9.6.3\n- Builder: -\n- User Config: modules, i18n, tailwindcss, css, plugins, devtools, compatibilityDate, runtimeConfig, vite, nitro\n- Runtime Modules: @geeks.solutions/nuxt-sections@3.0.1, @nuxt/image@1.10.0, @nuxtjs/i18n@9.5.4, @nuxtjs/tailwindcss@6.14.0, nuxt-lazytube@0.2.2, nuxt3-leaflet@1.0.13, @pinia/nuxt@0.11.0\n- Build Modules: -\n------------------------------\n\n\n### Reproduction\n\n* nuxt.config.ts\n\n```ts\nexport default defineNuxtConfig({\n ...(process.env.NODE_ENV === 'development' && {\n devServer: {\n https: {},\n host: '0.0.0.0',\n port: 443,\n }\n }),\n modules: [\n \"@geeks.solutions/nuxt-sections\",\n \"@nuxt/image\",\n \"@nuxtjs/i18n\",\n \"@nuxtjs/tailwindcss\",\n \"nuxt-lazytube\",\n \"nuxt3-leaflet\",\n \"@pinia/nuxt\"\n ],\n i18n: {\n detectBrowserLanguage: false,\n defaultLocale: \"en\",\n locales: [\n {\n name: \"French\",\n code: \"fr\",\n iso: \"fr\",\n file: \"fr.js\"\n },\n {\n name: \"English\",\n code: \"en\",\n iso: \"en\",\n file: \"en.js\"\n }\n ],\n langDir: \"lang/\",\n experimental: {\n localeDetector: 'localeDetector.ts'\n }\n },\n tailwindcss: {\n\n },\n css: [\n '~/assets/css/default.css'\n ],\n plugins: [\n '~/plugins/vue-dragscroll.js'\n ],\n devtools: { enabled: true },\n compatibilityDate: '2025-05-13',\n vite: {\n optimizeDeps: {\n include: ['quill', '@devdcodes9/quill-emojijs', 'quill-table-ui'],\n }\n },\n nitro: {\n compressPublicAssets: {\n gzip: true,\n brotli: true\n }\n }\n})\n```\n\n* localeDetector.ts inside i18n directory\n\n```ts\nconsole.log(\"Detector file loaded\")\n\n// Detect based on query, cookie, header\nexport default defineI18nLocaleDetector((event, config) => {\n\n console.log(\"Event\", event)\n\n // try to get locale from query\n const query = tryQueryLocale(event, { lang: '' }) // disable locale default value with `lang` option\n if (query) {\n return query.toString()\n }\n\n // try to get locale from cookie\n const cookie = tryCookieLocale(event, { lang: '', name: 'i18n_redirected' }) // disable locale default value with `lang` option\n if (cookie) {\n return cookie.toString()\n }\n\n // try to get locale from header (`accept-header`)\n const header = tryHeaderLocale(event, { lang: '' }) // disable locale default value with `lang` option\n if (header) {\n return header.toString()\n }\n\n // If the locale cannot be resolved up to this point, it is resolved with the value `defaultLocale` of the locale config passed to the function\n return config.defaultLocale\n})\n```\n\n* nuxi prepare\n* nuxi dev\n\n### Describe the bug\n\nI am trying to use the experimental localeDetector feature.\nThe localeDetector file is loaded and confirmed by having `Detector file loaded` logged on the server console.\n\nThe problem I am facing is that defineI18nLocaleDetector is never called and no Event is logged.\nAm I missing something ?\n\n### Additional context\n\nIn the documentation I saw that the local detector function is called per request on the server, so why the code inside the defineI18nLocaleDetector is never reached\n\n### Logs\n\n```shell\nNo errors logged at all\n```",[3062],{"name":3019,"color":3020},3651,"Code inside defineI18nLocaleDetector is not reached","2025-05-29T06:34:13Z","https://github.com/nuxt-modules/i18n/issues/3651",0.6919319,{"description":3069,"labels":3070,"number":3077,"owner":3022,"repository":3023,"state":3078,"title":3079,"updated_at":3080,"url":3081,"score":3082},"### 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_",[3071,3074],{"name":3072,"color":3073},"scope: language detection","1B89B8",{"name":3075,"color":3076},"scope: prerender","8B39DF",2507,"closed","Redirection to preferred language not works after pre-rendering pages","2025-06-09T22:33:59Z","https://github.com/nuxt-modules/i18n/issues/2507",0.61806643,{"description":3084,"labels":3085,"number":3087,"owner":3022,"repository":3023,"state":3078,"title":3088,"updated_at":3089,"url":3090,"score":3091},"### 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",[3086],{"name":3072,"color":3073},3039,"DetectBrowserLanguage rollback to default locale when using `prefix_except_default`","2025-06-08T01:03:16Z","https://github.com/nuxt-modules/i18n/issues/3039",0.65314317,{"description":3093,"labels":3094,"number":3096,"owner":3022,"repository":3023,"state":3078,"title":3097,"updated_at":3098,"url":3099,"score":3100},"### 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_",[3095],{"name":3072,"color":3073},3126,"`detectBrowserLanguage` does not detect browser lang as expected","2025-06-08T01:24:47Z","https://github.com/nuxt-modules/i18n/issues/3126",0.6565711,{"description":3102,"labels":3103,"number":3109,"owner":3022,"repository":3023,"state":3078,"title":3110,"updated_at":3111,"url":3112,"score":3113},"### 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```",[3104,3105,3106],{"name":3072,"color":3073},{"name":3075,"color":3076},{"name":3107,"color":3108},"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.6711353,{"description":3115,"labels":3116,"number":3118,"owner":3022,"repository":3023,"state":3078,"title":3119,"updated_at":3120,"url":3121,"score":3122},"### Environment\n\n------------------------------\n- Operating System: Linux\n- Node Version: v22.14.0\n- Nuxt Version: 3.17.2\n- CLI Version: 3.25.0\n- Nitro Version: 2.11.7\n- Package Manager: pnpm@10.6.5\n- Builder: -\n- User Config: -\n- Runtime Modules: -\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nI made a fork and modified the playground a bit. Start the playground and go to the `/jatest` page. You will see 404 screen, even though the page exists.\n\nhttps://github.com/MellKam/i18n/tree/v9\n\n### Describe the bug\n\nConsider the following config:\n\n```ts\nexport default defineNuxtConfig({\n modules: ['@nuxtjs/i18n'],\n i18n: {\n strategy: 'prefix_except_default',\n multiDomainLocales: true,\n locales: [\n {\n code: 'en',\n language: 'en-US',\n file: 'en.json',\n name: 'English',\n domains: ['localhost:3000']\n },\n {\n code: 'ja',\n language: 'ja-JP',\n file: 'ja.json',\n name: 'Japanese',\n domains: ['localhost:3000'],\n defaultForDomains: ['localhost:3000']\n }\n ]\n },\n compatibilityDate: '2025-02-04'\n})\n```\n\nThe default locale for domain localhost:3000 would be `ja`. The selected strategy is `prefix_except_default`, so prefix `ja` should be removed from path. \n\nBut let's consider the page path that looks like this: `/jatest`. When we try to go to this page we don't want the prefix to be removed as it's the part of the path and not the prefix of locale. But in `9.5.6` we would actually get 404 with message `Page /test not found`",[3117],{"name":3019,"color":3020},3715,"[v9] Default locale prefix incorrectly removed from route paths that start with locale substring (e.g. /jatest becomes /test)","2025-07-20T20:13:46Z","https://github.com/nuxt-modules/i18n/issues/3715",0.6742452,["Reactive",3124],{},["Set"],["ShallowReactive",3127],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fiHico6ipgfDTkZstDtdRsvzQz0Dk482fbTHqf0ppBP4":-1},"/nuxt-modules/i18n/3678"]