added language routing system
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { brandInfoRoutes, brandLegalRoutes } from './brands/brand-routes';
|
||||
import { languageGuard } from './guards/language.guard';
|
||||
|
||||
// Core routes (same across all brands)
|
||||
const coreRoutes: Routes = [
|
||||
@@ -29,13 +30,18 @@ const coreRoutes: Routes = [
|
||||
}
|
||||
];
|
||||
|
||||
// Combine core routes with brand-specific routes
|
||||
// All routes sit under a :lang prefix (e.g. /ru/cart, /en/item/5)
|
||||
export const routes: Routes = [
|
||||
...coreRoutes,
|
||||
...brandInfoRoutes,
|
||||
...brandLegalRoutes,
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: ''
|
||||
}
|
||||
path: ':lang',
|
||||
canActivate: [languageGuard],
|
||||
children: [
|
||||
...coreRoutes,
|
||||
...brandInfoRoutes,
|
||||
...brandLegalRoutes,
|
||||
{ path: '**', redirectTo: '' }
|
||||
]
|
||||
},
|
||||
// URLs without a language prefix → redirect to default language
|
||||
{ path: '**', redirectTo: 'ru' }
|
||||
];
|
||||
Reference in New Issue
Block a user