feat(i18n): add remote translation override and hot update support

1. add remote translation override feature with multi-tenant isolation
2. implement hot reload for i18n texts via componentRefresh mechanism
3. add boot timeout fallback and local cache support
4. add events for translation update and fallback state
This commit is contained in:
2026-06-10 14:12:49 +08:00
parent fd6527aa38
commit 071db2d70c
4 changed files with 409 additions and 22 deletions

12
main.js
View File

@@ -35,6 +35,18 @@ Vue.prototype.$eventBus = EventBus;
Vue.mixin(globalConfig);
// 远端 i18n 翻译热更新:复用项目原有"componentRefresh"机制(同 diy.js 下拉刷新)
// lang.js 在翻译覆写更新时 commit('setComponentRefresh'),
// golbalConfig.js 已把 componentRefresh 注册为全局 computed,
// 在此 watch 它并 $forceUpdate,触发所有页面内 {{$lang('xxx')}} 重新求值
Vue.mixin({
watch: {
componentRefresh() {
this.$forceUpdate();
}
}
});
App.mpType = 'app';
// 重写存储,增加前缀