ngx-translate-router
ngx-translate-router copied to clipboard
Question about routes without language prefix is present
Hi Guys,
I have an application that's already been propagated and has numerous backlinks. Currently, I'm implementing ngx-translate and ngx-translate-route.
The implementation wasn't easy for me, but it's working now. However, I'm facing a problem:
When external users access the old URLs without a language prefix, the application fails to recognize the routes. Is there an easy workaround for this?
Below is a snippet of my routing code. The issue arises because I'm only using lazy-loaded modules within a layout component.
const routes: Routes = [
{
path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{
path: '',
component: HomeLayoutComponent,
children: [
{
path: 'home',
loadChildren: () => import('./modules/home/home.module').then(m => m.HomeModule)
},
{
path: 'ads',
loadChildren: () => import('./modules/ads/ads.module').then(m => m.AdsModule),
data: { skipRouteLocalization: true }
},
{
path: 'tags',
loadChildren: () => import('./modules/tags/tags.module').then(m => m.TagsModule)
},
I'm seeking a solution to automatically append a default prefix to the URL when no prefix is present. I'm not using SSR; the application is entirely client-side, and I use nginx on the server side.
I'd prefer to resolve this issue internally within Angular, as I want to avoid using a 301 redirect in nginx. Is there an experienced herowho can assist me?
routes on app works fine with [routerLink]="'/maps' | localize" its only about external links.
Kind Regards