Inject route name without localization
See original GitHub issueIs your feature request related to a problem? Please describe.
When you work with localized route path, the only way to get the original route name is to remove the "___xx"
extra string from it.
For exemple, I use vuex-router-sync to build my multi steps form. This way I can rely on the url to ensure the user didn’t cheat any step. Middleware + store help me to achieve that.
It’s very annoying to split the localized route.name
property each time. Plus I feel not confortable with this hacky method.
Describe the solution you’d like
If I could have a unique id injected in the route object it would solve this. For exemple, the raw name would do the trick. This way I can :
- use it as a unique and useful id no matter the locale
- use
localPath({ name })
method to navigate to it
Describe alternatives you’ve considered
A working alternative is to retrieve this raw name by splitting the route name by "___"
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
How to support routes with and without language in URL in ...
Trying to set up localization for my current mvc project. I need to configure routing to support both urls: with and without language...
Read more >Route name localization #233 - robisim74/angular-l10n - GitHub
route name is not localized, because in my opinion the language of the URIs is English, and not a mix of English and...
Read more >Route - Angular
A configuration object that defines a single route. A set of routes are collected in a Routes array to define a Router configuration....
Read more >Rails Internationalization (I18n) API - Ruby on Rails Guides
The process of "localization" means to provide translations and localized ... Every helper method dependent on url_for (e.g. helpers for named routes like ......
Read more >Routing - Laravel - The PHP Framework For Web Artisans
Route parameters are injected into route callbacks / controllers based on their order - the names of the route callback / controller arguments...
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
I blame the vuex-router-sync package to soon. I experienced problems with nested routes. The final fix to this is:
You have to return the
routes
. Or alternatively, modify the original route instead of creating a new list.Also, I don’t think you can just add any property on the route object directly. Look at available properties at https://router.vuejs.org/api/#route-object-properties.
The
meta
object is likely a good choice in this case. Maybe try: