Replies: 1 comment 1 reply
-
I see your point, but changing the locale in If your use case doesn't require a locale prefix, you can disable it via I'll move this to a discussion since this seems to be a usage question and not a bug report. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
When I change locale via the LocaleSwitcher from the example I see the page in German.
However when I click back in the browser I see the page in English again.
My use case is a nextjs app which is embedded in a react-native-web-view and has a dedicated page for changing the language. When the user changes the language there is a back button to navigate away which uses the normal
router.back
command. Due to the described behaviour when the user navigates back the locale change is overridden.As a workaround for now I will have a local copy of the history so that I am able to go back by pushing a new url and not via the
router.back
.PS: I was not able to fork the bug template in CodeSandbox. Please check permissions or something.
Mandatory reproduction URL (CodeSandbox or GitHub repository)
https://codesandbox.io/p/sandbox/next-intl-bug-template-app-forked-zcymvq
Reproduction description
Steps to reproduce:
Result: Content is in English
Expected Result: Content is in German
Expected behaviour
I would expect that when I change the language and go back it will keep the new language. I understand that the URL has precedence over the next-intl cookie however I don't think this is the correct behaviour. If I have already selected my language for the site (and thus have my next-intl cookie set) I should be able to open any link (regardless of the locale) and automatically see the site in my selected locale. Therefore the precedence should be the cookie. When the URL changes the library should monitor the locale parameters and sync it with the cookie via router.replace to ensure consistency with the desired locale and back - forward movement works.
Beta Was this translation helpful? Give feedback.
All reactions