Prevent reload on switchLocalePath
See original GitHub issueWhat problem does this feature solve?
When you change the locale the page is reloaded. If you switch the language when typing a form, or editing something, all your changes are lost (one could prevent that with the provided callbacks, but it’s quite a lot of work to do it for all the cases in your app
What does the proposed changes look like?
It’s easy to simply change the locale with
this.$i18n.locale = lang
But it doesn’t change the current path.
I would be nice if one could pass a second parameter to switchLocalePath to prevent the reload the page, while still modifying the path and changing the locale
<div align="right">This feature request is available on Nuxt.js community (#c60)</div>Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:12
Top Results From Across the Web
Prevent reload on switchLocalePath · Issue #68 · nuxt ... - GitHub
switchLocalePath returns only the route name (String), based on the given locale code. If you want to change the locale on your javascript...
Read more >Language change without full page reload - Vue Storefront Docs
Language change without full page reload. By default, language changes cause a full page reload. To not trigger a full reload, you can...
Read more >Language Switcher doesn't apply the new locale
I was looking for this anwer, but I have a problem, his.$router.replace(this.switchLocalePath(language)); only changes URL but does not refresh ...
Read more >Lang Switcher - i18n-module
For this purpose, @nuxtjs/i18n's store module exposes a routeParams state property that will be merged with route params when generating lang switch routes...
Read more >How to prevent browser refresh, URL changes, or route ...
How to prevent browser refresh, URL changes, or route navigation in Vue · Prevent URL change and/or page reload. · Prevent router navigation....
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 FreeTop 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
Top GitHub Comments
The
this.$router.push
solution still reloads the page. Here’s how I solved this issue:I also needed a way to switch the locale without refreshing the whole page. After attempting the solution from this issue, I noticed that the active states of menus are basically gone. Is this a negative side effect @rchl talked about? Would there be any solution?