This commit is contained in:
wchino
2026-06-13 17:38:25 +08:00
parent e7e938f261
commit 7b33d9f9fa
190 changed files with 23222 additions and 4336 deletions

View File

@@ -0,0 +1,26 @@
/** 内容翻译 fallback当前语言 → 英文 → 中文 → 马来文 */
export function resolveTranslationFallback(map, locale) {
const chain = [locale, 'en-US', 'zh-CN', 'ms-MY'];
const seen = new Set();
for (const loc of chain) {
if (seen.has(loc))
continue;
seen.add(loc);
const v = map[loc];
if (v != null && String(v).trim() !== '')
return String(v).trim();
}
for (const v of Object.values(map)) {
if (v != null && String(v).trim() !== '')
return String(v).trim();
}
return '';
}
/** 前台语言显示名PRD 3.1 */
export const LOCALE_UI_LABELS = {
'zh-CN': '中文',
'ms-MY': 'Bahasa Melayu',
'en-US': 'English',
};
/** vue-i18n 缺 key 时en-US → zh-CN */
export const VUE_I18N_FALLBACK_LOCALES = ['en-US', 'zh-CN'];