微信小程序发布试用版本

This commit is contained in:
zhonghua1
2026-01-31 21:10:40 +08:00
parent 4ebeec45bc
commit 80d6d46182
338 changed files with 5767 additions and 6091 deletions

View File

@@ -69,20 +69,40 @@ if (i18nEnable) {
`);
let initLanguageAfter = () => {
function $i18n(e) {
// #ifdef VUE3
return i18n.global.messages[i18n.global.locale][e]
// #endif
return i18n.messages[i18n.locale][e]
try {
// #ifdef VUE3
// 安全检查:确保 i18n.global 存在
if (i18n && i18n.global && i18n.global.messages && i18n.global.locale) {
return i18n.global.messages[i18n.global.locale][e]
}
// #endif
// VUE2 或 fallback
if (i18n && i18n.messages && i18n.locale) {
return i18n.messages[i18n.locale][e]
}
// 如果 i18n 未初始化,返回空字符串或默认值
return ''
} catch (error) {
console.error('[i18n] 获取翻译文本失败:', error)
return ''
}
}
setTimeout(function() {
// 底部tabbar更新仅处理国际化文本不做权限控制
$i18n('tabbar').split(',').forEach((text, index) => {
uni.setTabBarItem({
index,
text,
complete: () => {}
})
})
try {
// 底部tabbar更新仅处理国际化文本不做权限控制
const tabbarText = $i18n('tabbar')
if (tabbarText) {
tabbarText.split(',').forEach((text, index) => {
uni.setTabBarItem({
index,
text,
complete: () => {}
})
})
}
} catch (error) {
console.error('[i18n] 更新 tabbar 失败:', error)
}
}, 1)
}
initLanguageAfter()