-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat(core): add locale switcher to Header #1907
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this, LGTM ✅
|
||
if (submission.value.id === defaultLocale) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just add a comment why we need to do this.
if (submission.value.id === defaultLocale) { | |
// Since `redirect` doesn't prepend the local to the redirect url | |
// when navigating the a default locale link, we need to prepend | |
// it ourselves to ensure the redirect happens. | |
if (submission.value.id === defaultLocale) { |
a0ed3c8
to
9fd43e0
Compare
* feat(core): add locale switcher to Header * fix: add translation for error * chore: add context comment
* feat(core): add locale switcher to Header * fix: add translation for error * chore: add context comment
What/Why?
Add locale switcher to the Header, using server action and
redirect
. In this use case we need to revalidate the/
to make sure the cookies get updated with the new locale. We also had to workaround an issue by redirecting to the/en
when the default locale is used.Testing
Locale switcher works as expected.
Kapture.2025-01-14.at.11.50.02.mp4