Trouble with Locale Switching in Next.js 14 using next-intl #722
Replies: 2 comments
-
Hey, thanks for trying out Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, it helped to understand so I can move on :) |
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
-
I'm currently working on a project where I'm using next-intl for localization with Next.js 14 and the App Router. This is my first time implementing it, and I've hit a snag.
My default language is set to English ('en'). However, when I'm on the Swedish version of the site (www.localhost/sv) and try to navigate to the English version by removing 'sv' from the URL, it automatically redirects me back to '/sv'. The only way I can switch to the English version is by explicitly typing '/en' in the URL; otherwise, I just keep bouncing back to the Swedish version.
I've followed the instructions on the official repository and the next-intl website, but I'm still struggling to make it work as expected. Interestingly, the demo works as I desire; for example, when on the German version and removing '/de' from the URL, it takes me to the English version.
Changing
localeDetection
tofalse
helps, but that removes the ability to detect and set the locale based on the user's preferences.Is there a good way to work around this problem?
Beta Was this translation helpful? Give feedback.
All reactions