Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change locale in SPA mode #3322

Closed
sebj54 opened this issue Jan 23, 2025 · 0 comments · Fixed by #3323
Closed

Cannot change locale in SPA mode #3322

sebj54 opened this issue Jan 23, 2025 · 0 comments · Fixed by #3323

Comments

@sebj54
Copy link

sebj54 commented Jan 23, 2025

Environment


  • Operating System: Darwin
  • Node Version: v22.11.0
  • Nuxt Version: 3.15.2
  • CLI Version: 3.20.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, i18n
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

Run:

git clone https://github.com/sebj54/debug-nuxt-i18n
npm ci
npm run generate
npx serve .output/public

Describe the bug

When running the website in SPA mode (static files from npm run generate) :

  • it is impossible to change the locale with switchLocalePath
  • when you hit an URL prefixed with the locale, the default one is still used
  • if you change the locale with setLocale, the locale is changed for $t but not for localePath

You can test the correct behavior in my reproduction by running npm run dev

Additional context

I tried @nuxtjs/i18n-edge and the bug also occurs with this version.

Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant