URL not translated to non default language?
See original GitHub issueHello,
I have followed the sample usage configuration with the following routes.
export const appRoutes: Routes = [
{
path: 'about-us',
component: AboutUsComponent,
},
{
path: '',
redirectTo: 'about-us',
pathMatch: 'full'
},
{path: '**', component: PageNotFoundComponent}
];
on my translation files
en.json
{
"ROUTES": {
"about-us": "about-us"
}
}
es.json
{
"ROUTES": {
"about-us": "acerca-de"
}
}
and on the localizeRouterHttpLoader json
{
"locales": ["en", "es"]
}
The routes /en/about-us and /es/about-uswork and change the language accordingly but the route/es/acerca-de` is not found.
Is this expected behaviour? Is this library supposed to translate paths too or simply add a prefix to whatever path the route declares to toggle a language change?
In case it might matter, I am in my AppComponent setting the default language to english too.
Cheers, Joel.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Fallback to default language when node not translated to ...
The default language is English. Mostly, the author will be translating the articles to Japanese and sometimes no translation.
Read more >Default Language is not pointing to site original URLs.
Hi. I have set up English as the default language for this site. However, after I selected the second language (Chinese in this...
Read more >Redirect and switch to default language if no translation exists
We want to use language path prefix in the URLs for pages with majority-translated content. On these pages we wish to re-direct users...
Read more >Language URL format options - WPML
WPML gives you the option of formatting your language URLs in domains, directories, or as parameters. Learn how it works and find what's...
Read more >If translation does not exist, link to default language?
modify your code of your navigation, check the language specific status of the page you want to add to the nav. · via...
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 Free
Top 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

Hi @lifenautjoe,
Your path
es/acerca-deshould work. If you are setting the default language in AppComponent that would most likely override settings from LocalizeRouter and could cause this behaviour. Try to use LocalizeRouter to set your default language. Check docs for more information on how default language setting works.If that doesn’t help, please create plunkr or provide link to repo so I can check it in your code.
Hi @meeroslav,
I made the Plunkr 🎉 .
I can reproduce the same issue in there as you will see when trying to go to the spanish version of a page and found another issue:
When the language changes, the page url doesnt get re-evaluated. If this is not desired functionality, what are we to do when the user selects another language? How can we send them to the page they are currently but in another language? So from
en/about-ustoes/acerca-deHere’s the plunkr with both issues.