mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:37:27 +00:00
fix(ci): resolve i18n typing and generated-policy drift
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user