Option to change the language without using the URL
See original GitHub issueHi there, How we can change user language without using the url and headers detection! …
The issue with the URL is that the user when get back to the website, the language will be returned to the default language (e.g. en)
not the language that the he have selected last time he visited the website (e.g fr)
.
So I want to store the language at localStorage
on my app’s settings page … then Next.js app get the language from the localStorage
.
How we can achieve that?
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Option to change the language without using the URL #1746
Hi there, How we can change user language without using the url and headers detection! .. The issue with the URL is that...
Read more >How to Change a Website That's in a Different Language to ...
Navigate to the webpage and wait for the Chrome extension to trigger a translate option. It will appear in the top right corner...
Read more >Change Chrome languages & translate webpages - Computer
On your computer, open Chrome. · At the top right, click More More and then Settings. · At the bottom, click Advanced. ·...
Read more >How to Change the Default Language of an Internet Browser.
On the right side of the Settings window, scroll down to the Languages section and click the Language option. Language option in Opera...
Read more >How can I switch the language in which websites ... - Super User
I would like all websites that I visit in my Chrome browser to be displayed in English. · Open the browser settings. ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@isaachinman I’m not sure this statement is correct:
next.js has support for internationalised routing.
So next.js does by default detect the locale (language-region-script) and automatically re-route the user based on locale. You can also change the locale yourself by simply adding a button and an onClick handler something like the following:
But this re-route’s the user. You cannot just change / select a language, it is tied to locale and routing. As a user of
next-i18next
I want to be able to select the set of translations to use independent of the user’s locale.Tying language to locale makes an assumption about the user that they speak the language in the region they are browsing from. If I use myself as an example, I am an English speaker, but live in Norway. So I want to select language, regardless of my region.
With
react-i18next
I can do this with thechangeLanguage
function. It seems there is no equivalent offered fromnext-i18next
. Ifnext-i18next
is responsible for deciding which set of translations to use then I believe you should be able to provide achangeLanguage
function to do this.Does this make sense / seem reasonable @isaachinman or have I misunderstood something?
The solution is to use a different i18next package: medium article