i18n
i18n copied to clipboard
Strategy prefix with detectBrowserLanguage not redirecting correctly on root in Static Site Generation
Environment
- Operating System: Windows_NT
- Node Version: v20.9.0
- Nuxt Version: 3.10.1
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: -
- User Config: app, vue, ssr, devtools, modules, image, googleFonts, i18n
- Runtime Modules: @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxt/[email protected], [email protected], [email protected]
- Build Modules: -
Reproduction
https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-cs5xbf?file=nuxt.config.ts
On local work fine.
site.com/
--> click /nl
to save cookie --> site.com/
redirect to site.com/nl
npm run generate npx serve .output/public
site.com/
--> click /nl
to save cookie --> site.com/
redirect to default lang site.com/en
Describe the bug
After generating a static page with pnpm run generate
and uploading it to hosting the application does not detect the existing cookie or browser language, in the case of (root) site.com it always redirects to defaultLocale (en) site.com/en.
When running the site locally, pnpm run dev
or run build
works correctly.
in addition, the "prefix" mode adds an error in the console after entering the root path.
Additional context
related? old task #2507
No response
Logs
No response