Keep language preference between page refreshes
See original GitHub issueThat seems a very basic issue, but I couldn’t find the answer anywhere.
After I change the language using:
i18n.changeLanguage(lng);
Everything updates as expected. But if I refresh the page it goes back to default language. How do I keep language preferences between page refreshes?
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Keep language preference after page refresh from ...
How to keep the English language after refreshing the page? The default language is NL, when I switch English and after the refresh, ......
Read more >Language change without full page reload - Vue Storefront Docs
By default, language changes cause a full page reload. To not trigger a full reload, you can change your i18n configuration (opens new...
Read more >Save State to LocalStorage & Persist on Refresh with React.js
Learn how to save React state and load it when a page refreshes using localStorage. We'll learn how to set up a simple...
Read more >How to properly internationalize a React application using ...
We are going to adapt the app to detect the language according to the user's preference. And we will create a language switcher...
Read more >How to translate React application with react-i18next - part 2
But wait — if we change the language and refresh the page, the language will reset to default one. Why? Because we don't...
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
Solved by removing
lngininit().i fix the problem before lng: ‘ar’ and thats back to defualt language when reload the page after lng: localStorage. getItem(key) || ‘ar’ thats will go to default language after first load when there’s no localStorage and when reload if there’s a localStorage it will remember the choices.
thank you for help