added language routing system

This commit is contained in:
sdarbinyan
2026-02-26 22:23:08 +04:00
parent a4765ffe98
commit e4206d8abc
34 changed files with 197 additions and 98 deletions

View File

@@ -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' }
];