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

fix: sync cookie when setting locale #2877

Merged

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented Mar 24, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to 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

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede self-assigned this Mar 24, 2024
@BobbieGoede BobbieGoede force-pushed the fix/sync-cookie-when-setting-locale branch from 34b3a02 to d132452 Compare March 24, 2024 12:14
@kazupon
Copy link
Collaborator

kazupon commented Mar 24, 2024

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!

@BobbieGoede BobbieGoede marked this pull request as ready for review March 24, 2024 19:12
@BobbieGoede BobbieGoede merged commit 1ce4aae into nuxt-modules:main Mar 24, 2024
7 checks passed
@BobbieGoede BobbieGoede deleted the fix/sync-cookie-when-setting-locale branch March 24, 2024 19:17
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

detectBrowserLanguage doesn't work
2 participants