nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.75k stars 483 forks source link

fix: sync cookie when setting locale #2877

Closed BobbieGoede closed 7 months ago

BobbieGoede commented 7 months ago

πŸ”— Linked issue

❓ Type of change

πŸ“š Description

Resolves #2829

Please note that this actually changes the cookie behavior slightly, this is why I set this RP to draft status.

These changes ensure that the cookie is always set and up to date (if configured of course), even when no redirection takes place necessarily. I feel like this would only ensure the correct locale is used even if the user has not been redirected (e.g. entering the website on a page in which redirection would occur anyways), are there any downsides to this change?

If we want to keep this change we may need to adjust the documentation a bit, I haven't looked into this yet.

πŸ“ Checklist

kazupon commented 7 months ago

These changes ensure that the cookie is always set and up to date (if configured of course), even when no redirection takes place necessarily. I feel like this would only ensure the correct locale is used even if the user has not been redirected (e.g. entering the website on a page in which redirection would occur anyways), are there any downsides to this change?

Thanks for your fixing! I believe that your fix is no downside. In fact, your change has passed testing and has not caused any regression. Let’s merge this PR!

makamekm commented 4 months ago

It looks like this PR has broken the package with infinity redirects in some browsers like Opera or Yandex.

BobbieGoede commented 4 months ago

It looks like this PR has broken the package with infinity redirects in some browsers like Opera or Yandex.

Can you open an issue with a minimal reproduction? πŸ™