|\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).",[2886],{"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.7304661,{"description":2893,"labels":2894,"number":2896,"owner":2856,"repository":2857,"state":2858,"title":2897,"updated_at":2898,"url":2899,"score":2900},"### 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```",[2895],{"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.73821265,{"description":2902,"labels":2903,"number":2910,"owner":2856,"repository":2857,"state":2911,"title":2912,"updated_at":2913,"url":2914,"score":2915},"### Environment\n\n- Operating System: Darwin\n- Node Version: v22.11.0\n- Nuxt Version: 3.16.2\n- CLI Version: 3.25.0\n- Nitro Version: 2.11.9\n- Package Manager: pnpm@9.12.3\n- Builder: -\n- User Config: compatibilityDate, devtools, nitro, modules\n- Runtime Modules: nitro-cloudflare-dev@0.2.2\n- Build Modules: -\n\n### Reproduction\n\nhttps://github.com/dongnaebi/nuxt-cf\n\n### Describe the bug\n\nAfter upgrading i18n to version 9.5.3, I discovered a hydration mismatch in the production environment (Cloudflare Worker). Upon investigation, I found that `v-html` wasn't rendering properly. My code is as follows:\n\n```html\n\u003Ch1 v-html=\"t('hero').replace('\\n', '\u003Cbr>')\">\u003C/h1>\n```\n\nDowngrading to 9.5.2 resolves the issue, and everything works fine. Running `nuxt dev` locally also works, but when building locally and using `wrangler dev`, the problem can be reproduced.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[2904,2907],{"name":2905,"color":2906},"possible regression","B78041",{"name":2908,"color":2909},"scope: hydration","008866",3581,"closed","v-html in version 9.5.3 not rendering correctly","2025-05-28T16:37:16Z","https://github.com/nuxt-modules/i18n/issues/3581",0.67024714,{"description":2917,"labels":2918,"number":2925,"owner":2856,"repository":2857,"state":2911,"title":2926,"updated_at":2927,"url":2928,"score":2929},"### 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```",[2919,2922],{"name":2920,"color":2921},"scope: ssg","85eac7",{"name":2923,"color":2924},"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.69009745,{"description":2931,"labels":2932,"number":2936,"owner":2856,"repository":2857,"state":2911,"title":2937,"updated_at":2938,"url":2939,"score":2940},"### Environment\r\n\r\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v18.16.0\r\n- Nuxt Version: 3.7.1\r\n- CLI Version: 3.7.3\r\n- Nitro Version: 2.6.2\r\n- Package Manager: pnpm@8.6.12\r\n- Builder: -\r\n- User Config: extends, telemetry, ssr, fontMetrics, nitro, routeRules, runtimeConfig, build, modules, delayHydration, image, components, bugsnag, devtools, i18n, experimental, pwa, app, dnGraphqlClient, vite, plugins\r\n- Runtime Modules: @nuxtjs/fontaine@0.4.1, @pinia/nuxt@0.4.11, @nuxt/devtools@0.8.2, @vite-pwa/nuxt@0.1.0, nuxt-bugsnag@7.0.0, @digitalnatives/css-variables/nuxt@5.1.3, @digitalnatives/graphql-client@4.0.3, @nuxtjs/i18n@8.0.0-rc.4, @nuxt/image@1.0.0-rc.1, nuxt-delay-hydration@1.2.1, @digitalnatives/composables@2.0.1\r\n- Build Modules: -\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nA naïve reproduction is the following:\r\n\r\n```js\r\nconst route = useRoute(); \r\nconst locale = useLocale();\r\n\r\n// On switch, this will first log the NEW locale with the OLD path, then it will trigger a second time, logging the NEW locale with the NEW path\r\nwatchEffect(() => {\r\n console.log(route.fullPath);\r\n console.log(locale);\r\n});\r\n```\r\n\r\nAdd it to a global component in the layout that doesn't get mounted/umounted on URI change.\r\n\r\n\r\n\r\n### Describe the bug\r\n\r\nWhen using prefixed routes and a language switcher as described in the docs, it seems the locale changes before the route does.\r\n\r\nWhen watching the locale with `useAsyncData()` or `useLazyAsyncData()` this will cause the results of this call to be associated with the wrong URL/path, which then has a side-effect of refetching API data which was already pre-rendered in Nuxt static mode. Therefore, the pre-rendered payload is NOT used in this pattern, even though it should.\r\n\r\nI've also seen this lead to data mismatching to the wrong paths, but this is a bit harder to create a reproduction for.\r\n\r\n### Additional context\r\n\r\nMy current workaround is this;\r\n\r\ncomposable:\r\n```js\r\nexport const useVariables = () => {\r\n const route = useRoute();\r\n const { $i18n }: any = useNuxtApp();\r\n // Don't automatically update the site and url to ensure they both change at the same time\r\n variables.uri = toValue(route.path);\r\n variables.lang = toValue($i18n?.localeProperties)?.apiLanguageHandle;\r\n\r\n // Update variables manually when the route changes, at this point both the locale AND the URI are correct.\r\n watch(() => route.path, () => {\r\n variables.uri = toValue(route.path);\r\n variables.lang = toValue($i18n?.localeProperties)?.apiLanguageHandle;\r\n });\r\n return { variables };\r\n});\r\n```\r\n\r\nthen:\r\n\r\n```js\r\nconst { variables } = useVariables();\r\nuseAsyncData(() => { console.log('trigger!') } , { watch: [ variables ] });\r\n```\r\n\r\n\r\nPerhaps it would be possible to inject the locale & locale properties into the localized route meta? That way we could just watch the route and apply the language from that.\r\n\r\nRelates to #2278 \r\n\r\n### Logs\r\n\r\n_No response_",[2933],{"name":2934,"color":2935},"switch locale","D2FCC6",2377,"`locale` changes BEFORE the route path does, which causes issues with (static) `asyncData`-payloads","2025-05-16T11:44:11Z","https://github.com/nuxt-modules/i18n/issues/2377",0.6970164,{"description":2942,"labels":2943,"number":2947,"owner":2856,"repository":2857,"state":2911,"title":2948,"updated_at":2949,"url":2950,"score":2951},"### Environment\n\n```\n- Operating System: Darwin\n- Node Version: v22.14.0\n- Nuxt Version: 3.16.2\n- CLI Version: 3.25.0\n- Nitro Version: 2.11.9\n- Package Manager: npm@10.9.2\n- Builder: -\n- User Config: ssr, compatibilityDate, devtools, modules, i18n\n- Runtime Modules: @nuxt/content@3.4.0, @nuxtjs/i18n@9.5.3\n- Build Modules: -\n```\n\n### Reproduction\n\nReproduction: https://stackblitz.com/~/github.com/ismaoc/test2\nCode: https://github.com/ismaoc/test2\n\n### Describe the bug\n\nJust created a fresh Nuxt project with `npm create nuxt \u003Cproject_name>` and added nuxti18n with `npx nuxi@latest module add i18n`. Added a basic locale config (same as the docs) and get a \"not found error\" or \"Failed to parse JSON file.\" for the locales files.\n\nThe config\n\n```\ni18n: {\n lazy: false,\n locales: [\n { code: 'en', file: 'en' },\n { code: 'fr', file: 'fr' },\n ],\n }\n```\n\nthrows the error:\n\n\n```\n[9:12:36 PM] ERROR Pre-transform error: Failed to load url /i18n/locales/en (resolved id: /Users/user/pruebas/test2/i18n/locales/en) in /Users/user/pruebas/test2/.nuxt/i18n.options.mjs. Does the file exist?\n\n\n[9:12:36 PM] ERROR Pre-transform error: Failed to load url /i18n/locales/fr (resolved id: /Users/user/pruebas/test2/i18n/locales/fr) in /Users/user/pruebas/test2/.nuxt/i18n.options.mjs. Does the file exist?\n```\n\nIf I add the .json extension like this:\n\ni18n: {\n defaultLocale: 'en',\n locales: [\n { code: 'en', name: 'English', file: 'en.json' },\n { code: 'fr', name: 'Français', file: 'fr.json' }\n ]\n }\n\nthrows:\n\n```\n ERROR Pre-transform error: Failed to parse JSON file. 9:19:58 PM\n Plugin: vite:json\n File: /Users/user/pruebas/test2/i18n/locales/fr.json\n\n\n ERROR Pre-transform error: Failed to parse JSON file. 9:19:58 PM\n Plugin: vite:json\n File: /Users/user/pruebas/test2/i18n/locales/en.json\n```\n\nThanks.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[2944],{"name":2945,"color":2946},"upstream issue","fbca04",3560,"Bug: i18n Configuration Not Loading Locale Files","2025-05-16T11:33:25Z","https://github.com/nuxt-modules/i18n/issues/3560",0.6972403,{"description":2953,"labels":2954,"number":2961,"owner":2856,"repository":2857,"state":2911,"title":2962,"updated_at":2963,"url":2964,"score":2965},"### Environment\n\n- Operating System: `Darwin`\n- Node Version: `v20.11.1`\n- Nuxt Version: `3.13.2`\n- CLI Version: `3.15.0`\n- Nitro Version: `2.9.7`\n- Package Manager: `npm@10.2.4`\n- Builder: `-`\n- User Config: `default`\n- Runtime Modules: `@nuxtjs/i18n@8.5.5`, `@pinia/nuxt@0.6.0`\n- Build Modules: `-`\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-paob67?file=plugins%2Finit.ts but for some reason stackblitz not setting cookie when using setLocale from useI18n;\n\n### Describe the bug\n\nWhen calling window.location.reload() immediately in callback in\nnuxtApp.hook('i18n:localeSwitched'), cookie and current language resets to a previous value.\n\n```\nnuxtApp.hook('i18n:localeSwitched', () => window.location.reload());\n```\n\nBut if you wrap reload in setTimeout it works as expected\n\n```\nnuxtApp.hook('i18n:localeSwitched', () => {\n setTimeout(() => window.location.reload(), 100);\n});\n```\n\n### Additional context\n\nIf this hook is async we should probably wait for it and then execute our callback?\n\n### Logs\n\n_No response_",[2955,2958],{"name":2956,"color":2957},"scope: locales","006b75",{"name":2959,"color":2960},"scope: hooks","CF3B0A",3192,"window.location.reload immediately after nuxtApp.hook('i18n:localeSwitched') not working as expected","2025-05-26T20:38:28Z","https://github.com/nuxt-modules/i18n/issues/3192",0.7133334,["Reactive",2967],{},["Set"],["ShallowReactive",2970],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fxh_MzqEapa8TGysFvGInn9avD-5-EmFkqkNjSRmZ1WY":-1},"/nuxt-modules/i18n/3608"]