|\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).",[2852],{"name":2853,"color":2854},"pending triage","c2e0c6",3609,"nuxt-modules","i18n","open","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.59628284,{"description":2864,"labels":2865,"number":2867,"owner":2856,"repository":2857,"state":2858,"title":2868,"updated_at":2869,"url":2870,"score":2871},"### 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```",[2866],{"name":2853,"color":2854},3598,"defineI18nRoute is not working with no_prefix strategy","2025-05-13T14:21:14Z","https://github.com/nuxt-modules/i18n/issues/3598",0.6579355,{"description":2873,"labels":2874,"number":2878,"owner":2856,"repository":2857,"state":2858,"title":2879,"updated_at":2880,"url":2881,"score":2882},"## Updates\n\n- 2024/01/02: Updated reproduction and steps to reproduce at https://github.com/nuxt-modules/i18n/issues/2524#issuecomment-1873823456\n- 2025/05/02: Updated reproduction for v9.5.4: https://github.com/nuxt-modules/i18n/issues/2524#issuecomment-2847024120\n\n## Original post\n\n### Environment\n\nWorking directory: /home/projects/aoniwxvlm.github 13:55:30\nNuxt project info: 13:55:30\n\n------------------------------\n- Operating System: Linux\n- Node Version: v18.18.0\n- Nuxt Version: 3.8.0\n- CLI Version: 3.9.1\n- Nitro Version: 2.7.0\n- Package Manager: npm@9.4.2\n- Builder: -\n- User Config: devtools, modules, i18n\n- Runtime Modules: @nuxtjs/i18n@8.0.0-rc.5\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-fyaxh8\n\n### Describe the bug\n\nThe root redirect takes the `Accept-Language` header into account:\n\n```\ncurl -H \"Accept-Language: fr\" -I http://localhost:3000\n```\n\n```\nHTTP/1.1 302 Found\naccess-control-allow-origin: *\nlocation: /fr\ncontent-type: text/html\ndate: Wed, 25 Oct 2023 11:49:52 GMT\nconnection: close\n```\n\nBut everything else does not:\n\n```\ncurl -H \"Accept-Language: fr\" -I http://localhost:3000/foo\n```\n\n```\nHTTP/1.1 302 Found\naccess-control-allow-origin: *\nlocation: /en/foo\ncontent-type: text/html\ndate: Wed, 25 Oct 2023 11:49:41 GMT\nconnection: close\n```\n\nThis also relates to #2131 because I'm using the `prefix` strategy, which means I should actually get a 404 on the `/foo` request. Therefore, I think fixing #2131 will also fix this issue, but not vice versa.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[2875],{"name":2876,"color":2877},"browser language detection","c5def5",2524,"Inconsistent handling of `Accept-Language` header","2025-05-02T11:49:20Z","https://github.com/nuxt-modules/i18n/issues/2524",0.6845719,{"description":2884,"labels":2885,"number":2890,"owner":2856,"repository":2857,"state":2858,"title":2891,"updated_at":2892,"url":2893,"score":2894},"### Environment\n\nI am using @nuxtjs/i18n 9.5.4 with nuxt 3.17.3 for a statically generated website.\n\n\n### Reproduction\n\n-\n\n### Describe the bug\n\n\nIn nuxt.config.ts I have the default i18n settings:\n\n```\n\t\tdetectBrowserLanguage: {\n\t\t\tuseCookie: true,\n\t\t\tcookieKey: 'i18n_redirected',\n\t\t\tredirectOn: 'root'\n\t\t},\n```\n\nThe first time the site loads, before the i18n_redirected cookie exists, I see the following error in the console:\n\n```\nHydration completed but contains mismatches.\n```\n\nSubsequent visits to the site, once the cookie exists, do not have this error.\n\nI have confirmed that i18n locale detection is the issue by testing this configuration:\n\n```\n\t\tdetectBrowserLanguage: false\n```\n\nWhen detectBrowserLanguage is false, the issue does not occur.\n\nEDIT: Upon some further testing, the error only seems to occur if the browser locale that i18n matches is different from the defaultLocale. For example, if my browser locale is \"de\" but the i18n defaultLocale is \"en\" then the error will occur when i18n flips over to to the 'de' pages. By comparision, if the browser locale is \"en\", same as i18n defaultLocale, then the error will never occur. \n\nThe site renders fine, so it is not a big deal. But I'm wondering if there is anything that can be done to prevent that error from happening in the console on the initial load, before the cookie exists?\n\nThanks (in advance) for your help!\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[2886,2887],{"name":2853,"color":2854},{"name":2888,"color":2889},"need reproduction 💻","CD234A",3608,"Hydration mismatch on initial static site load, before i18n cookie is set","2025-05-21T00:33:31Z","https://github.com/nuxt-modules/i18n/issues/3608",0.6944569,{"description":2896,"labels":2897,"number":2899,"owner":2856,"repository":2857,"state":2858,"title":2900,"updated_at":2901,"url":2902,"score":2903},"### 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```",[2898],{"name":2853,"color":2854},3651,"Code inside defineI18nLocaleDetector is not reached","2025-05-29T06:34:13Z","https://github.com/nuxt-modules/i18n/issues/3651",0.6979901,{"description":2905,"labels":2906,"number":2908,"owner":2856,"repository":2857,"state":2858,"title":2909,"updated_at":2910,"url":2911,"score":2912},"### Environment\n\n\nSuch as in the reproduction.\n\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-kvjaukgj?file=nuxt.config.ts\n\n### Describe the bug\n\nPreviously I was using an older version of the module, there 'npm generate' created an index.html with a redirect to the default language. \n`npx serve .output/public` now displays only folder structure. You can only enter manually by adding /en in the link.\n\nI couldn't find any information about this change in the documentation and on the nuxt help channel.\n\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[2907],{"name":2853,"color":2854},3624,"Missing generated index.html in root folder on “prefix” mode. SSG","2025-05-20T12:46:00Z","https://github.com/nuxt-modules/i18n/issues/3624",0.7039066,{"description":2914,"labels":2915,"number":2917,"owner":2856,"repository":2857,"state":2858,"title":2918,"updated_at":2919,"url":2920,"score":2921},"### Environment\n\n------------------------------\n- Operating System: Linux\n- Node Version: v23.11.1\n- Nuxt Version: 3.17.4\n- CLI Version: 3.25.1\n- Nitro Version: 2.11.12\n- Package Manager: npm@11.4.0\n- Builder: -\n- User Config: compatibilityDate, devtools, modules, i18n, devServer\n- Runtime Modules: @nuxtjs/i18n@9.5.5\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nMinimal repo here https://github.com/ThibaudDauce/test_i18n\n\nThis is my `app.vue`:\n```html\n\u003Ctemplate>\n \u003Cdiv>\n \u003Cp>{{ $t('Hello {name}', { name: 'John' }) }}\u003C/p>\n \u003Cp>{{ $t('The weather today is {condition}!', { condition: 'sunny' }) }}\u003C/p>\n \u003C/div>\n\u003C/template>\n```\n\nWith this `i18n/i18n.config.ts`:\n```ts\nexport default defineI18nConfig(() => {\n return {\n missingWarn: false,\n formatFallbackMessages: true,\n }\n})\n```\n\nAnd this `nuxt.config.ts`:\n```ts\nexport default defineNuxtConfig({\n compatibilityDate: '2025-05-15',\n devtools: { enabled: true },\n modules: ['@nuxtjs/i18n'],\n i18n: {\n defaultLocale: 'fr',\n },\n devServer: {\n port: 8080,\n },\n})\n```\n\n`missingWarn: false` is working so the config seems to be loaded correctly.\n\n### Describe the bug\n\nWhen I set `formatFallbackMessages: true`, the messages are not formatted in the template.\n",[2916],{"name":2853,"color":2854},3670,"Cannot set `formatFallbackMessages`","2025-06-02T08:53:05Z","https://github.com/nuxt-modules/i18n/issues/3670",0.71052605,{"description":2923,"labels":2924,"number":2926,"owner":2856,"repository":2857,"state":2858,"title":2927,"updated_at":2928,"url":2929,"score":2930},"### Describe the feature\n\nCurrently, the files property in the locales configuration only supports an array of file paths. I would like to propose supporting a prefix option for each file to namespace its translations when loaded.\n```\ni18n: {\n locales: [\n {\n code: \"en\",\n name: \"English\",\n files: [\n { path: \"en/common.json\", prefix: \"common\" },\n { path: \"en/checkout.json\", prefix: \"checkout\" },\n { path: \"en/order.json\", prefix: \"order\" }\n ]\n }\n ]\n}\n```\nWith this configuration, the keys inside en/checkout.json would be accessible via t('checkout.key'), while en/common.json would be t('common.key'), and so on.\n\n### Additional information\n\n- [ ] 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).",[2925],{"name":2853,"color":2854},3593,"Support for file prefix in locales.files config","2025-05-11T07:15:31Z","https://github.com/nuxt-modules/i18n/issues/3593",0.71781075,{"description":2932,"labels":2933,"number":2943,"owner":2856,"repository":2857,"state":2944,"title":2945,"updated_at":2946,"url":2947,"score":2948},"### Environment\n\n```\n- Operating System: Darwin\n- Node Version: v22.11.0\n- Nuxt Version: 3.13.2\n- CLI Version: 3.16.0\n- Nitro Version: 2.10.4\n- Package Manager: npm@10.9.0\n- Builder: -\n- User Config: default\n- Runtime Modules: @nuxtjs/i18n@9.1.0, @pinia/nuxt@0.7.0\n- Build Modules: -\n```\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-l8bdri?file=pages%2Ftest.vue,pages%2Findex.vue but it won't work in stackblitz so it needs to be reproduced in local environment\n\n### Describe the bug\n\nWhen using `\u003CNuxtLinkLocale>` with `to=\"/some-url-in-your-application\"` with `target=\"_blank\"`, locale prefix is not inserted in the resulting URL.\n\n### Additional context\n\nIn my opinion prefix should be added (or omitted if it is a default locale) as I use `\u003CNuxtLinkLocale>` here with exact purpose to direct to my application. Otherwise I would have used just an ordinary `\u003Ca>` tag or even `\u003CNuxtLink>`\n\n### Logs\n\n```shell\n\n```",[2934,2937,2940],{"name":2935,"color":2936},"bug 🐛","ee0701",{"name":2938,"color":2939},"PR Welcome","40922A",{"name":2941,"color":2942},"nuxt-link-locale","B327C3",3252,"closed","NuxtLinkLocale with an attribute target=\"_blank\" does not respect the locale prefix","2025-05-22T15:26:02Z","https://github.com/nuxt-modules/i18n/issues/3252",0.6528722,{"description":2950,"labels":2951,"number":2958,"owner":2856,"repository":2857,"state":2944,"title":2959,"updated_at":2960,"url":2961,"score":2962},"### Environment\n\n- Nuxt version: 3.17.4\n- @nuxtjs/i18n version: 10.0.0-beta-7\n- Deployment target: Static site (nuxi generate)\n- Works fine in SSR build (nuxi build)\n- Node version: 22\n\n### Reproduction\n\nhttps://codesandbox.io/p/devbox/prod-https-6gz2f5\n\n- run `pnpm generate` command and check output folder. there is no i18n folder. \n- run `pnpm start` to run generate build. open browser console. you'll see `Failed to load messages for locale en FetchError: [GET] \"/_i18n/en/messages.json\":`\n\n### Describe the bug\n\nWhen generating a static site using `nuxi generate`, I get the following error in the console when loading the site:\n```\nFailed to load messages for locale en FetchError: [GET] \"/_i18n/en/messages.json\": 404 Not Found\n```\n\nThe same Nuxt app works fine with nuxtjs/i18n v9\n\nSetting `ssr: true` works fine for both build & generate \n\n### Additional context\n\nHere’s part of my nuxt.config.ts:\n```\n{\n defaultLocale: 'en',\n debug: import.meta.env.DEV,\n locales: [\n {\n code: 'en',\n language: 'en-US',\n file: 'en.json',\n name: 'English',\n },\n {\n code: 'es',\n file: 'es.json',\n name: 'Spanish',\n },\n {\n code: 'tl',\n file: 'tl.json',\n name: 'Tagalog (Filipino)',\n },\n ],\n strategy: 'no_prefix',\n detectBrowserLanguage: {\n useCookie: true,\n cookieKey: 'dmc.locale',\n redirectOn: 'root',\n },\n}\n```\n\n### Logs\n\n```shell\nTkPgtAp_.js:9 Failed to load messages for locale en FetchError: [GET] \"/_i18n/en/messages.json\": 404 Not Found\n at async s (N_fP37pm.js:19:23784)\n at async Object.loadLocaleMessages (N_fP37pm.js:53:9792)\n at async B1 (N_fP37pm.js:53:11552)\n at async setup (N_fP37pm.js:67:48664)\n at async t$ (N_fP37pm.js:19:30748)\n at async i (N_fP37pm.js:19:31273)\n at async N_fP37pm.js:19:31213\n at async Promise.all (:8080/index 5)\n at async N_fP37pm.js:19:31122\n at async i (N_fP37pm.js:19:31273)\n at async n$ (N_fP37pm.js:19:31324)\n at async Qk (N_fP37pm.js:1100:1993)\n```",[2952,2955],{"name":2953,"color":2954},"scope: ssg","85eac7",{"name":2956,"color":2957},"scope: ssr","0052cc",3645,"Failed to load messages for locale only in static site generated with nuxi generate (404 on /_i18n/en/messages.json)","2025-05-26T18:06:23Z","https://github.com/nuxt-modules/i18n/issues/3645",0.6703205,["Reactive",2964],{},["Set"],["ShallowReactive",2967],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fzhfixdctxLaW26y_d2wUmhCtiGqgzoiHePmLurTh-ic":-1},"/nuxt-modules/i18n/3619"]