I'm doing an i18n Angular app, so far it works great.
However I have same route strings for different languages, which isn't best for SEO.
Is it possible to have 'path' properties of Routes array be different for each language?
Ex:
const appRoutesEN: Routes = [
{ path: 'crisis-center', component: CrisisListComponent },
{ path: 'hero/:id', component: HeroDetailComponent },
{
path: 'heroes',
component: HeroListComponent,
data: { title: 'Heroes List' }
},
{ path: '**', component: PageNotFoundComponent }
];
Is it possible to define also a appRoutesFR: Routes if yes how I can use it? Shall I inject LOCALE_ID to routing module? If so how?
ngx-translateand I'd like to see some solution there instead of having yet another dependency.ngx-i18nsupportpackage is big help to streamline the process. More on this here. Only thing those tools can't help is route strings. Route variables are not a problem, if you've been creating your app i18n way, route variables can be translated versions but not route strings.npm scriptsto extract strings to be translated and then build/serve in a selected language. Since route strings are only part that can't be in this streamline process, I've created all route definitions in all available languages and before I build in desired language, I comment out that those needed and comment ones not to be used. This is the ugly part and that is because I have lazy loaded modules with child routes. If I didn't I could use @estus' recommended package. If you need more info contact me.