Files
thebet365/packages/shared/src/locale.ts
Mars cc737e2924 feat(admin,api,player): 赛事分组管理、盘口独立页与多语言展示优化
- 管理端按联赛展示单场,新增赛事/单场流程与列表展开状态保持

- 盘口赔率迁至独立页面,保存按钮仅在有修改时高亮

- API 新增联赛列表与子场查询,按 locale 返回队名并修复编译

- 波胆其它选项与促销标签等 i18n 补齐,文案更易懂
2026-06-04 16:25:03 +08:00

29 lines
893 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 内容翻译 fallback当前语言 → 英文 → 中文 → 马来文 */
export function resolveTranslationFallback(
map: Record<string, string | undefined | null>,
locale: string,
): string {
const chain = [locale, 'en-US', 'zh-CN', 'ms-MY'];
const seen = new Set<string>();
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: Record<string, string> = {
'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'] as const;