|\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).",[3041],{"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.70891786,{"description":3048,"labels":3049,"number":3051,"owner":3022,"repository":3023,"state":3024,"title":3052,"updated_at":3053,"url":3054,"score":3055},"### 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```",[3050],{"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.7105235,{"description":3057,"labels":3058,"number":3062,"owner":3022,"repository":3023,"state":3063,"title":3064,"updated_at":3065,"url":3066,"score":3067},"## 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",[3059],{"name":3060,"color":3061},"need reproduction","CD234A",3752,"closed","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.67678756,{"description":3069,"labels":3070,"number":3072,"owner":3022,"repository":3023,"state":3063,"title":3073,"updated_at":3074,"url":3075,"score":3076},"### Environment\n\n**Module version:** \n`@nuxtjs/i18n` version: `^9.4.0`\n\n**Nuxt version:** \n`Nuxt 3.16.2`\n\n### ❗ Problem\n\nAfter building CI/CD pipeline of project, the generated `nuxt.i18n.options.mjs` includes **absolute paths** to the locale files, for example:\n\n```js\n{\n path: \"/home/gitlab-runner/builds/QEWN8sP-g/0/client/i18n/locales/ru/errors.json\",\n cache: undefined\n}\n```\n\n### Reproduction\n\nConfigure @nuxtjs/i18n in nuxt.config.ts:\n\n```\ni18n: {\n locales: [\n { code: 'ru', file: 'ru/errors.json' },\n { code: 'ro', file: 'ro/errors.json' },\n ],\n langDir: 'i18n/locales/',\n defaultLocale: 'ru',\n}\n```\n\nRun nuxt build\n\nInspect the contents of .output/public/_nuxt/ or nuxt.i18n.options.mjs\n\nNotice absolute paths included in the files array\n\n💡 Workarounds tried\n\n✅ fullInstall: false → no effect\n\n✅ Using relative langDir and file values → still resolves to absolute paths\n\n✅ Changing build environment → problem persists\n\n### Describe the bug\n\nPlease avoid emitting absolute file paths into the build output. Relative or virtualized paths would ensure cleaner builds, better security, and fewer environment-specific artifacts.\n\nLet me know if you need a minimal reproduction repo or additional logs.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell\n\n```",[3071],{"name":3019,"color":3020},3742,"Absolute file paths included in production bundle","2025-07-21T08:55:25Z","https://github.com/nuxt-modules/i18n/issues/3742",0.69252163,{"description":3078,"labels":3079,"number":3083,"owner":3022,"repository":3023,"state":3063,"title":3084,"updated_at":3085,"url":3086,"score":3087},"### 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```",[3080],{"name":3081,"color":3082},"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.69288784,{"description":3089,"labels":3090,"number":3094,"owner":3022,"repository":3023,"state":3063,"title":3095,"updated_at":3096,"url":3097,"score":3098},"### Environment\n\n- Operating System: Windows_NT\n- Node Version: v22.14.0\n- Nuxt Version: 3.16.2\n- CLI Version: 3.24.1\n- Nitro Version: 2.11.8\n- Package Manager: yarn@1.22.22\n- Builder: -\n- User Config: devtools, app, modules, css, build, i18n, site, compatibilityDate\n- Runtime Modules: @nuxtjs/tailwindcss@6.13.2, @nuxt/image@1.9.0, @nuxtjs/i18n@9.5.3, @hypernym/nuxt-anime@2.1.1, @nuxtjs/sitemap@7.2.10, @nuxtjs/robots@5.2.9 \n- Build Modules: -\n\n### Reproduction\n\nhttps://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-yr15sl4p?file=locales%2Fen%2Findex.ts\n\n### Describe the bug\n\nI’m trying to auto-import all `.json` files in a ` locales/[lang]/` folder using `import.meta.glob` in each language’s `index.ts` file. This worked fine in Nuxt 2 using `require.context`, but in Nuxt 3 with` @nuxtjs/i18n`, I’m encountering the following error:\n\n`[plugin:vite:esbuild] Failed locale loading: 'unknown' type in **locales/ar/index.ts`**\n\n\n### Additional context\n\nWhat I’m Trying to Do\n```\n// locales/ar/index.ts\nconst modules = import.meta.glob('./**/*.json', { eager: true })\n\nconst messages: Record\u003Cstring, any> = {}\n\nfor (const path in modules) {\n const key = path\n .replace('./', '')\n .replace('.json', '')\n .replace(/\\//g, '.')\n messages[key] = modules[path].default\n}\n\nexport default messages\n```\n```\n// nuxt.config.ts\ni18n: {\n strategy: 'prefix_except_default',\n defaultLocale: 'ar',\n lazy: true,\n langDir: 'locales',\n locales: [\n { code: 'ar', name: 'Arabic', file: 'ar/index.ts' },\n { code: 'en', name: 'English', file: 'en/index.ts' }\n ]\n}\n```\n\nI expected Nuxt to allow ` import.meta.glob` usage in language-specific ` index.ts` files to auto-import and combine all locale messages from nested JSON files.\n\n**What Happened Instead**\n\nDynamic path template literals are not supported by Vite\n\nEven static `../locales/ar/**/*.json` fails due to path resolution issues\n\nErrors like `unknown type` or `Failed locale loading` appear\n\n\n**Workarounds Tried**\nUsing `require.context` – unsupported in Vite\n\nSwitching to manual static imports – works but violates DRY and doesn't scale\n\nMoving the glob loader to a utility file – still fails due to unresolved paths\n\nReplacing `lodash.set` with custom merging logic – no difference in behavior\n\nChecked paths, JSON validity, eager option – no effect\n\n### Logs\n\n```shell\n\n```",[3091],{"name":3092,"color":3093},"need more info","e295d6",3536,"Failed locale loading with static JSON imports in Nuxt 3","2025-05-23T10:27:57Z","https://github.com/nuxt-modules/i18n/issues/3536",0.7010341,{"description":3100,"labels":3101,"number":3102,"owner":3022,"repository":3023,"state":3063,"title":3103,"updated_at":3104,"url":3105,"score":3106},"In order for the runtime config merging to work properly, there must be an entry for each locale in `domainLocales`. This can be done in the nuxt.config like so:\n\n\n```ts\ndefineNuxtConfig({\n runtimeConfig: {\n public: i18n: {\n domainLocales: {\n en: { domain: '' },\n de: { domain: '' }\n }\n }\n }\n})\n```\n\nBut to make this easier for users, nuxt-i18n could pre-configure these values based on `locales` module option.",[],3694,"Pre-populate `domainLocales` based on module configuration","2025-06-25T21:20:58Z","https://github.com/nuxt-modules/i18n/issues/3694",0.7021747,{"description":3108,"labels":3109,"number":3110,"owner":3022,"repository":3023,"state":3063,"title":3064,"updated_at":3111,"url":3112,"score":3113},"## Bug Report\n\n### Description\nWhen using , the i18n module doesn't respect the URL prefix language when the browser sends an header.\n\n### Expected Behavior\nWhen accessing path, the page should display in Chinese (zh) regardless of the header value.\n\n### Actual Behavior\nWhen accessing path with , the page displays in English (en) instead of Chinese (zh).\n\n### Steps to Reproduce\n1. Configure i18n with \n2. Access URL with language prefix (e.g., )\n3. Send request with header containing different language preference (e.g., )\n4. Observe that the page displays in the accept-language preferred language instead of the URL prefix language\n\n### Configuration\n- Strategy: \n- URL example: \n- Accept-Language header: \n\n### Expected Result\nPage should display in Chinese (zh) as specified by the URL prefix.\n\n### Actual Result \nPage displays in English (en) as specified by the accept-language header.",[],3750,"2025-07-23T06:43:58Z","https://github.com/nuxt-modules/i18n/issues/3750",0.70399,["Reactive",3115],{},["Set"],["ShallowReactive",3118],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fhNfX5gbnjhKrTSKIkDAGTx9EUnNIzcK771-LTeq8zPE":-1},"/nuxt-modules/i18n/3593"]