localize-router icon indicating copy to clipboard operation
localize-router copied to clipboard

locale switching breaks on second switch

Open SrgSteak opened this issue 6 years ago • 5 comments

How to reproduce: check out project, move to demo/cli dir npm install ng serve go to /de/benutzer or /en/users click translate to DE/EN click other button EN/DE

Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'de/benutzer//%5Bobject%20Object%5D' noMatchError@http://localhost:4200/vendor.js:57472:25

SrgSteak avatar Nov 07 '18 08:11 SrgSteak

Also, switching from http://localhost:4200/en/users/Ada%20Lovelace with the translate button results in http://localhost:4200/de/benutzer/Ada%20Lovelace;id=Ada%20Lovelace and thats not helpful at all.

SrgSteak avatar Nov 07 '18 08:11 SrgSteak

@SrgSteak, which version of localize-router is this - 1.0.1 or 2.0.0-RC.x?

meeroslav avatar Nov 07 '18 13:11 meeroslav

2.0.0-RC.1 as you can find here: https://github.com/Greentube/localize-router/blob/00a8517ee9cccfa736b6ee152603eed2d485a894/demo/cli/package.json#L28

SrgSteak avatar Nov 07 '18 13:11 SrgSteak

We have exactly the sam problem - it always add ;id={PARAM} if we has a parameter in URL.

from package.json: "localize-router": "^2.0.0-RC.2",

qubiack avatar Dec 05 '18 10:12 qubiack

I found this issue can be fixed by ensuring you have / at the start of your path to translate. I.e.:

this.localizeSvc.translateRoute('/dashboard/admin/')

or [routerLink]="['/privacy-policy' | localize]"

or with params: [routerLink]="['/authenticate/register/', monthlyContributions] | localize"

lee-wilkins avatar Dec 07 '18 11:12 lee-wilkins