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

Calling setLocale does not automatically update the locale cookie. #3254

Open
wzc520pyfm opened this issue Dec 4, 2024 · 0 comments
Open

Comments

@wzc520pyfm
Copy link

Environment


  • Operating System: Darwin
  • Node Version: v20.16.0
  • Nuxt Version: 3.14.1592
  • CLI Version: 3.16.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: default
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

Sorry, the current reproduction starter (edge) cannot be started. I will provide a repl later.

This is My nuxt config:

export default defineNuxtConfig({
// ...
i18n: {
    lazy: true,
    locales: [
      { code: 'en', language: 'en-US', name: 'English' },
      { code: 'zh-cn', language: 'zh-CN', name: 'Chinese' }
    ],
    defaultLocale: 'en',
    detectBrowserLanguage: {
      useCookie: true,
      redirectOn: 'root',
      alwaysRedirect: true
    },
    skipSettingLocaleOnNavigate: true
  },
})

Describe the bug

When I set skipSettingLocaleOnNavigate to true, setLocale does not automatically update the locale cookie. But the documentation says: setLocale automatically updates the locale cookie. My current solution is to call both setLocale and setLocaleCookie.

I thought that the locale cookie should be set automatically when detectBrowserLanguage is enabled. If you agree, I can help pr.

Additional context

No response

Logs

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

No branches or pull requests

1 participant