fix: 子模块 i18n 桥接 -- 透传 :locale prop,修复嵌入页显示 i18n ID

根因:子项目组件用 useI18n({useScope:'global'}) 注入,嵌入时解析到宿主
mainPage 的 i18n 实例(不含子项目文案)-> 文案回退成 key(显示 ID)。

修复:
- z449 / timeTableFix 组件改用 useLocale composable 直读自身模块级 i18n 实例
- ttf 新增独立 i18n(中英 locale + useLocale),抽取所有硬编码中文
- mainPage 侧 Timetable/MobileGameWrapper 包装器透传 :locale prop
- 两个子模块 gitlink 更新至各自修复 commit

验证:构建后两个子模块 chunk 含真实中文文案,无 useI18n 注入残留
This commit is contained in:
Zikai
2026-07-24 09:02:38 +00:00
parent 6ad6c15e9d
commit d9309756c7
5 changed files with 22 additions and 12 deletions

View File

@@ -1,19 +1,26 @@
<script setup>
// ★ timetable 页签的 mainPage 侧包装器。
// 子模块 timeTableFix 的 App.vue 作为纯功能组件被 import本包装器负责
// 子模块 timeTableFix 的 App.vue 作为便携式组件被 import本包装器负责
// 1. 套 PageShell 统一容器宽度与标题(与其他页签对齐)
// 2. 持有 KeepAlive 匹配用的组件名(与模块 id 一致),子模块自身不持 name
// 3. 把 mainPage 当前语言经 :locale prop 透传给子模块的独立 i18n 实例,
// 使其跟随父项目语言开关响应式切换(不共享 messages仅同步 locale 值)
// 子模块独立运行时不经过本包装器,保持纯净。
defineOptions({ name: 'timetable' })
import { computed } from 'vue'
import PageShell from '../../components/ui/PageShell.vue'
import i18n from '../../i18n/index.js'
import TimeTableFixApp from '../../../third_party/timeTableFix/src/App.vue'
// 透传父项目当前语言给子应用(响应式:切语言时子应用内容跟随)
const locale = computed(() => i18n.global.locale.value)
</script>
<template>
<PageShell title-key="tabs.timetable">
<div class="timetable__frame">
<TimeTableFixApp />
<TimeTableFixApp :locale="locale" />
</div>
</PageShell>
</template>