Just like getLocale
, why isn't there a setLocale
?
#1382
Unanswered
forhadakhan
asked this question in
Q&A
Replies: 1 comment
-
The implementation of If it's a cookie, you can use the approach shown in example-app-router-without-i18n-routing—this example works fine on Vercel. I'll move this to a discussion since it's a usage question. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I tried using App Router setup without i18n routing and defined a local switcher following official example.
This solution worked fine in the local development environment but resulted in an error (Cookies can only be modified in a Server Action or Route Handler.
nextjs 14.2.13
) in the production environment on Vercel."Describe the solution you'd like
I think
next-intl
should have a direct utility to set the locale from both client and server components. Just as we can access the current locale usinggetLocale
in server oruseLocale
in client, there should be a similar feature for setting the locale.NOTE: If I'm missing something or if such solutions already exist, please point me to the direct solution.
Describe alternatives you've considered
Alternative solutions might vary from developer to developer. I am working on a way to address this, but it would be better if there were an official solution.
Beta Was this translation helpful? Give feedback.
All reactions