Currently, it is possible to change the current locale by providing a Link with a different locale.
This can be combined with usePathname to show a link in a different locale. See #278
For my project, I want to use a custom select component to change the locale. I cannot use the Link component in this situation. Instead, I want to change the locale through a function. So I tried to use useRouter but it does not have any option to pass the new locale to it.
It would be great to have a simple function to get the current url with a specific locale to simplify the development of a component to change the locale.
The documentation should contain some kind of solution because this question has been asked multiple times, mostly by people who do not understand that the single source of truth does rely on the current URL. See: #320, #407
Currently, it is possible to change the current locale by providing a Link with a different locale.
This can be combined with usePathname to show a link in a different locale. See #278
For my project, I want to use a custom select component to change the locale. I cannot use the
Linkcomponent in this situation. Instead, I want to change the locale through a function. So I tried to use useRouter but it does not have any option to pass the new locale to it.It would be great to have a simple function to get the current url with a specific locale to simplify the development of a component to change the locale.
The documentation should contain some kind of solution because this question has been asked multiple times, mostly by people who do not understand that the single source of truth does rely on the current URL. See: #320, #407