foundation: project guide, tooling, design tokens, bilingual shell and routing contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
11
src/app/core/i18n/locale.resolver.ts
Normal file
11
src/app/core/i18n/locale.resolver.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { type ResolveFn } from '@angular/router';
|
||||
import { DEFAULT_LOCALE, isAppLocale, type AppLocale } from './locale';
|
||||
import { LocaleService } from './locale.service';
|
||||
|
||||
export const localeResolver: ResolveFn<AppLocale> = (route) => {
|
||||
const localeValue: unknown = route.data['locale'];
|
||||
const locale = isAppLocale(localeValue) ? localeValue : DEFAULT_LOCALE;
|
||||
inject(LocaleService).setLocale(locale);
|
||||
return locale;
|
||||
};
|
||||
Reference in New Issue
Block a user