fix(ci): resolve i18n typing and generated-policy drift

This commit is contained in:
Peter Steinberger
2026-03-02 04:24:01 +00:00
parent fa9148400e
commit 1c0d36eed0
3 changed files with 22 additions and 9 deletions

View File

@@ -37,6 +37,10 @@ export function isSupportedLocale(value: string | null | undefined): value is Lo
return value !== null && value !== undefined && SUPPORTED_LOCALES.includes(value as Locale);
}
function isLazyLocale(locale: Locale): locale is LazyLocale {
return LAZY_LOCALES.includes(locale as LazyLocale);
}
export function resolveNavigatorLocale(navLang: string): Locale {
if (navLang.startsWith("zh")) {
return navLang === "zh-TW" || navLang === "zh-HK" ? "zh-TW" : "zh-CN";
@@ -51,13 +55,10 @@ export function resolveNavigatorLocale(navLang: string): Locale {
}
export async function loadLazyLocaleTranslation(locale: Locale): Promise<TranslationMap | null> {
if (locale === DEFAULT_LOCALE) {
if (!isLazyLocale(locale)) {
return null;
}
const registration = LAZY_LOCALE_REGISTRY[locale];
if (!registration) {
return null;
}
const module = await registration.loader();
return module[registration.exportName] ?? null;
}