From 5b5e923a0b65d0b0863c4bc3a3e44748dd9aba6d Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Tue, 17 Mar 2026 14:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BD=93=E5=89=8D=E5=BD=A9?= =?UTF-8?q?=E9=87=91=E6=B1=A0-=E5=AE=89=E5=85=A8=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/locales/langs/en/dice/lottery_pool_config.json | 2 +- .../src/locales/langs/zh/dice/lottery_pool_config.json | 4 ++-- saiadmin-artd/src/locales/pageLocaleLoader.ts | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/saiadmin-artd/src/locales/langs/en/dice/lottery_pool_config.json b/saiadmin-artd/src/locales/langs/en/dice/lottery_pool_config.json index d7d5cdc..60da1c4 100644 --- a/saiadmin-artd/src/locales/langs/en/dice/lottery_pool_config.json +++ b/saiadmin-artd/src/locales/langs/en/dice/lottery_pool_config.json @@ -27,7 +27,7 @@ "profitCalcHint": "Sum of (win amount including BIGWIN minus 100 ticket cost) per round; refreshes every 2s while open.", "tierRuleTitle": "Tier Rule", "tierRuleContent": "When player profit in this pool is below safety line, use player T*_weight; when above or equal, use pool T*_weight (kill).", - "killScoreWeights": "Kill weights (type=1 read-only)", + "killScoreWeights": "Kill weights", "killWeightNote": "(Kill weights from pool config type=1; edit in list.)", "btnResetProfit": "Reset Player Total Profit", "btnSaveSafetyLine": "Save Safety Line", diff --git a/saiadmin-artd/src/locales/langs/zh/dice/lottery_pool_config.json b/saiadmin-artd/src/locales/langs/zh/dice/lottery_pool_config.json index ecac23f..f7bffc1 100644 --- a/saiadmin-artd/src/locales/langs/zh/dice/lottery_pool_config.json +++ b/saiadmin-artd/src/locales/langs/zh/dice/lottery_pool_config.json @@ -27,8 +27,8 @@ "profitCalcHint": "计算方式:每局按“当前中奖金额(含超级大奖 BIGWIN)减去抽奖券费用 100”累加,弹窗打开期间每 2 秒自动刷新", "tierRuleTitle": "抽奖档位规则", "tierRuleContent": "当玩家在当前彩金池的累计盈利 低于安全线 时,按 玩家 的 T*_weight 权重抽取档位;当累计盈利 高于或等于安全线 时,按 当前彩金池 的 T*_weight 权重抽取档位(杀分)。", - "killScoreWeights": "杀分权重(type=1 只读)", - "killWeightNote": "(杀分权重来自奖池配置 type=1,请在列表中编辑对应记录)", + "killScoreWeights": "杀分权重", + "killWeightNote": "(杀分权重来自奖池配置,请在列表中编辑对应记录)", "btnResetProfit": "重置玩家累计盈利", "btnSaveSafetyLine": "保存安全线", "ruleSafetyLineRequired": "请输入安全线", diff --git a/saiadmin-artd/src/locales/pageLocaleLoader.ts b/saiadmin-artd/src/locales/pageLocaleLoader.ts index 427f909..8bb67ce 100644 --- a/saiadmin-artd/src/locales/pageLocaleLoader.ts +++ b/saiadmin-artd/src/locales/pageLocaleLoader.ts @@ -27,6 +27,12 @@ function getModuleKey(locale: string, path: string): string { let lastLoadedPath: string | null = null let lastLoadedLocale: string | null = null +/** 获取当前语言(locale 可能是 string 或 Ref) */ +function getCurrentLocale(): string { + const loc = i18n.global.locale + return typeof loc === 'string' ? loc : (loc as { value: string }).value +} + /** * 加载并合并页面翻译到 i18n 的 page 命名空间 */ @@ -36,7 +42,7 @@ export async function loadPageLocale(routePath: string): Promise { clearPageLocale() return } - const locale = i18n.global.locale.value + const locale = getCurrentLocale() const key = getModuleKey(locale, path) const modules = locale === LanguageEnum.EN ? enModules : zhModules const loader = modules[key] @@ -64,7 +70,7 @@ export async function loadPageLocale(routePath: string): Promise { * 清除 page 命名空间(进入无页面翻译的路由时调用) */ export function clearPageLocale(): void { - const locale = i18n.global.locale.value + const locale = getCurrentLocale() const messages = i18n.global.getLocaleMessage(locale) as Record if (messages && 'page' in messages) { const next = { ...messages }