Function traverseSnapshot not properly assembling the new translated route.
See original GitHub issueI’m submitting a … (check one with “x”)
[ x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if similar feature request does not exist
[ ] support request => Suggested place for help and support is [stackoverflow](https://stackoverflow.com/), search for similar question before posting
Description
Using angular 7+ if a route as parameters, for example :name or :id, this method on this line “…Object.keys(snapshot.params).length ? [snapshot.params] : [],” will add to the route the following “;name=valueofthename” or “;id=valueoftheid”. There is another problem on the line above on the urlPart this urlPart I think needs to be splited by “/” otherwise if my route is something like “person/:name” the the result of calling the method changeLanguage that calls the traverseSnapshot will result in something like “lang/person%2Fvalueofthename;name=valueofthename”.
🔬 Minimal Reproduction (if applicable)
On this code https://stackblitz.com/edit/localize-router-v2-issue-template-o6mvus if you write on the link “/en/hello/name” and after click on on of the buttons to change the language you will sew on the console the error “Cannot match any routes. URL Segment: ‘de/hello%2Fname;name=name’” the type of the error does not matter for the problem as it is just a not matching error, the problem is actully the construction of the url that is not properly constructed.
🌍 Your Environment
Angular Version:
Angular CLI: 7.0.5
Node: 10.13.0
OS: win32 x64
Angular: 7.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.5
@angular-devkit/build-angular 0.10.5
@angular-devkit/build-optimizer 0.10.5
@angular-devkit/build-webpack 0.10.5
@angular-devkit/core 7.0.5
@angular-devkit/schematics 7.0.5
@angular/cli 7.0.5
@ngtools/webpack 7.0.5
@schematics/angular 7.0.5
@schematics/update 0.10.5
rxjs 6.3.3
typescript 3.1.6
webpack 4.19.1
Localize Router Version:
localize-router: 2.0.0-RC.2
localize-router-http-loader: 1.0.2
Anything else relevant?
@ngx-translate/core: 11.0.1
@ngx-translate/http-loader: 4.0.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:11
I have a potential fix for this here: https://github.com/cywolf/localize-router/tree/fix-151
Hi @dragorwyin that is strange your case is very similar with mine and the solution by @cywolf worked for me, did you check your routing configuration to see if there is something wrong? are you able to create a example to reproduce your problem?