|\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).",[2866],{"name":2853,"color":2854},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.7225072,{"description":2873,"labels":2874,"number":2879,"owner":2856,"repository":2857,"state":2858,"title":2880,"updated_at":2881,"url":2882,"score":2883},"### 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```",[2875,2876],{"name":2853,"color":2854},{"name":2877,"color":2878},"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.72593915,{"description":2885,"labels":2886,"number":2890,"owner":2856,"repository":2857,"state":2858,"title":2891,"updated_at":2892,"url":2893,"score":2894},"## 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_",[2887],{"name":2888,"color":2889},"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.7261141,{"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: 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: yarn@1.22.22\n- Builder: -\n- User Config: devtools, nitro, router, app, runtimeConfig, components, modules, intercom, build, sentry, sourcemap, i18n, tailwindcss, site, vite, sitemap\n- Runtime Modules: @sentry/nuxt/module@9.14.0, @nuxtjs/i18n@9.5.4, @nuxtjs/tailwindcss@6.13.2, @nuxtjs/sitemap@7.2.10, nuxt-3-intercom@1.1.2\n- Build Modules: -\n------------------------------\n\n### Reproduction\n\nN/A\n\n### Describe the bug\n\nCurrently we have setup some redirects using nitro RouteRules.\nFor example:\n\n```\n'/test' = { redirect: {to: '/foo/test', code: 301 }, prerender: false }\n```\n\nAt the same time we have disabled the prerender option.\n\nWhen we run `nuxt build` we get 404 error for above redirects.\nIf we disable the redirect routeRules everything works as expected.\n\nNot sure what i18n module does to redirects urls but it crashes the build process.\n\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[2898],{"name":2853,"color":2854},3606,"issue with nitro routeRules and redirect","2025-05-16T11:05:04Z","https://github.com/nuxt-modules/i18n/issues/3606",0.72621554,{"description":2905,"labels":2906,"number":2908,"owner":2856,"repository":2857,"state":2858,"title":2909,"updated_at":2910,"url":2911,"score":2912},"### 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).",[2907],{"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.75272137,{"description":2914,"labels":2915,"number":2917,"owner":2856,"repository":2857,"state":2918,"title":2919,"updated_at":2920,"url":2921,"score":2922},"### Environment\n\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v20.14.0\r\n- Nuxt Version: 3.12.4\r\n- CLI Version: 3.12.0\r\n- Nitro Version: 2.9.7\r\n- Package Manager: yarn@1.22.22\r\n- Builder: -\r\n- User Config: ssr, compatibilityDate, devtools, modules, components, runtimeConfig, site, ogImage, i18n, tailwindcss, sitemap, content, gtag, cookieControl\r\n- Runtime Modules: @nuxtjs/i18n@8.3.3, @nuxtjs/tailwindcss@6.12.1, @nuxtjs/seo@2.0.0-rc.16, @nuxt/content@2.13.2, @nuxthq/studio@2.0.3, nuxt-gtag@2.1.0, @dargmuesli/nuxt-cookie-control@8.4.7\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\nwww.vinoteqa.com/blog\n\n### Describe the bug\n\nWhen I try to visit a page, other than the root, I get redirected to the localized url but still get a error. As soon as I reload the page, it is displayed correctly. \r\n\r\nTry it at: www.vinoteqa.com/blog\r\n\r\nAm I missing some configuration?\n\n### Additional context\n\n```ts\r\n i18n: {\r\n defaultLocale: 'en',\r\n locales: [{\r\n code: 'en',\r\n iso: 'en',\r\n name: 'English',\r\n file: 'en.json',\r\n },\r\n {\r\n code: 'de',\r\n iso: 'de',\r\n name: 'Deutsch',\r\n file: 'de.json',\r\n },\r\n {\r\n code: 'it', \r\n iso: 'it',\r\n name: 'Italiano',\r\n file: 'it.json',\r\n }],\r\n strategy: 'prefix',\r\n lazy: false,\r\n langDir: 'locales/',\r\n },\r\n ```\r\n \r\n \n\n### Logs\n\n_No response_",[2916],{"name":2853,"color":2854},3062,"closed","404 on all pages other than root with `prefix` strategy","2025-05-21T19:36:56Z","https://github.com/nuxt-modules/i18n/issues/3062",0.68581766,{"description":2924,"labels":2925,"number":2929,"owner":2856,"repository":2857,"state":2918,"title":2930,"updated_at":2931,"url":2932,"score":2933},"### Environment\n\n- Operating System: Darwin\r\n- Node Version: v18.16.0\r\n- Nuxt Version: 3.6.2\r\n- Nitro Version: 2.5.2\r\n- Package Manager: yarn@1.22.19\r\n- Builder: vite\r\n- User Config: build, css, devtools, modules, nitro, postcss, routeRules, runtimeConfig\r\n- Runtime Modules: @pinia/nuxt@0.4.11, @nuxt/image@1.0.0-rc.1, nuxt-api-party@0.13.0, @nuxtjs/i18n@8.0.0-beta.13\r\n- Build Modules: -\n\n### Reproduction\n\nhttps://github.com/joeykamsteeg/nuxt3-i18n-beforelocaleswitch-hook-not-working\n\n### Describe the bug\n\nThis hook should be triggered on app load (according to the documentation) and with initialSetup property we could hook our own logic how to handle URLs without locale in the URL. This is now not possible.\r\n\r\nIssue was reported earlier (#2248) but was closed without a resolution. \n\n### Additional context\n\n_No response_\n\n### Logs\n\n_No response_",[2926],{"name":2927,"color":2928},"hook","CF3B0A",2260,"Follow up: hook i18n:beforeLocaleSwitch does not use the locale that is return in the function","2025-05-22T19:39:58Z","https://github.com/nuxt-modules/i18n/issues/2260",0.6982736,{"description":2935,"labels":2936,"number":2946,"owner":2856,"repository":2857,"state":2918,"title":2947,"updated_at":2948,"url":2949,"score":2950},"### 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```",[2937,2940,2943],{"name":2938,"color":2939},"bug 🐛","ee0701",{"name":2941,"color":2942},"PR Welcome","40922A",{"name":2944,"color":2945},"nuxt-link-locale","B327C3",3252,"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.70824116,{"description":2952,"labels":2953,"number":2955,"owner":2856,"repository":2857,"state":2918,"title":2956,"updated_at":2957,"url":2958,"score":2959},"### Environment\r\n\r\nOperating System: Windows 11\r\n\r\nPackages:\r\n@esbuild/linux-x64@0.23.1 extraneous\r\n@nuxtjs/i18n@8.5.2\r\n@parcel/watcher-linux-x64-glibc@2.4.1 extraneous\r\n@parcel/watcher-linux-x64-musl@2.4.1 extraneous\r\n@rollup/rollup-linux-x64-gnu@4.21.2 extraneous\r\n@rollup/rollup-linux-x64-musl@4.21.2 extraneous\r\nnode-addon-api@7.1.1 extraneous\r\nnuxt-typed-router@3.6.5\r\nnuxt@3.13.\r\n\r\nPackage Manager: npm\r\n\r\n### Reproduction\r\n\r\n1. Install nuxt-typed-router\r\n2. Install @nuxtjs/i18n\r\n3. Set strategy for @nuxtjs/i18n in nuxt.config.ts to 'prefix'\r\n4. Get [unhandledRejection] Declaration or statement expected during build\r\n\r\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-qm6vpw?file=package.json,nuxt.config.ts,i18n.config.ts\r\n\r\n### Describe the bug\r\n\r\nWhen both I18n and nuxt-typed-router are installed and strategy for I18n is set to \"prefix\", the nuxt-typed-router throws this exception: \r\n\r\n[unhandledRejection] Declaration or statement expected. (128:8) \r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[2954],{"name":2853,"color":2854},3091,"[unhandledRejection] Declaration or statement expected - @nuxt/i18n + nuxt-typed-router","2025-05-16T12:00:31Z","https://github.com/nuxt-modules/i18n/issues/3091",0.7095737,["Reactive",2961],{},["Set"],["ShallowReactive",2964],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fmvBcnUTQa9S0RPUvuogErJdAydaDvvuLe-0hPZtPN0s":-1},"/nuxt-modules/i18n/3598"]