diff --git a/Web/src/i18n/index.ts b/Web/src/i18n/index.ts index 32eea183..674dc5ec 100644 --- a/Web/src/i18n/index.ts +++ b/Web/src/i18n/index.ts @@ -167,6 +167,12 @@ export const i18n = createI18n({ fallbackLocale: 'zh-CN', messages, globalInjection: true, + fallbackFormat: false, // 关闭默认的 fallback 行为 + missing: (locale, key) => { + // 安全地获取最后一部分,如果没有'.'则返回整个key + const lastPart = key.includes('.') ? key.split('.').pop()! : key; + return lastPart.replace(/\${(.+?)}/g, '$1'); + } }); //iso 3166-1 国家代码