gilsdav / ngx-translate-router

Translate routes using ngx-translate
131 stars 43 forks source link

Changing the language does not add prefix to the url #121

Open stevengunneweg opened 2 years ago

stevengunneweg commented 2 years ago

I have a project set up with the latest Angular and latest ngx-translate and ngx-translate router. The alwaysSetPrefix property is set to false to not have a language prefix on the default language. When I navigate within this project everything works as expected, the prefix is added/removed when necessary. However when I change the language I see the translated url without prefix. When I refresh I end up in my wildcard route handling, the error page.

I created a simple example project to reproduce this (https://github.com/stevengunneweg/translate-router-test).

Is this an issue with my setup or is this an issue in the ngx-translate-router library? Please help.

stevengunneweg commented 2 years ago

Is there anyone with a similar issue or insight on what might be the cause?

stevengunneweg commented 2 years ago

After updating to Angular 14 (test project is updated) the behaviour is even worse. When I change the language the application navigates from http://localhost:4200/testin-en to http://localhost:4200/test-nl/test-nl.

The language prefix is completely lost and filled with the translated path which causes the path to show twice. When refreshing the route can obviously not be matched and thus the error page shows.