Answer the question
In order to leave comments, you need to log in
How can an application add locale to the url?
In general, there is already a ready-made application. language detection only works from localStorage. those. the language is retrieved from the storage (or default, if empty) and set in ngx-translate. The bottom line is that it is not implemented in ur (in routes).
{
path: 'home',
loadChildren: './home.module#HomeModule'
}
{
path: ':lang/home',
loadChildren: './home.module#HomeModule'
}
Answer the question
In order to leave comments, you need to log in
Hmm... and what's the problem with doing it instead of adding a new route, like this for example:
const lang = localStorage.getItem('lang') || 'ru';
{
path: lang + '/home',
loadChildren: './home.module#HomeModule'
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question