refactor: 国际化文本迁移至全局 locales/messages.js

将组件级 i18n 对象重构为统一由全局 locales/messages.js 管理,确保中英文语言切换时正确显示对应文本。

- 新增 utils/i18n.js 国际化工具函数
- 更新 store/$t.mixin.js 翻译混入逻辑
- 迁移 pkgService、pkgBooking、pkgAccount、pkgExplore、pages 等共 58 个组件的中英文文本至全局消息表
This commit is contained in:
liangjian
2026-07-24 13:43:41 +08:00
parent 445bd850f4
commit 6e721ccc7e
58 changed files with 1810 additions and 4065 deletions

View File

@@ -7,7 +7,7 @@
<text class='icon tn-icon-left'></text>
</view>
<view class="tn-flex tn-flex-col-center tn-flex-row-center ">
<text class="tn-text-bold tn-text-lg tn-color-black">{{ t('navTitle') }}</text>
<text class="tn-text-bold tn-text-lg tn-color-black">{{ $tr('资料图库') }}</text>
</view>
</tn-nav-bar>
@@ -17,7 +17,7 @@
<view class="justify-content-item align-content-item" style="width: 100vw;">
<view class="tn-flex tn-flex-col-center" style="border: 1rpx solid #D2D2D2;border-radius: 100rpx;padding: 10rpx 20rpx 10rpx 20rpx;width: 90%;">
<text class="tn-icon-search justify-content-item tn-padding-right-xs tn-color-gray tn-text-lg"></text>
<input class="justify-content-item" :placeholder="t('searchPlaceholder')" name="input" placeholder-style="color:#AAAAAA" style="width: 90%;"></input>
<input class="justify-content-item" :placeholder="$tr('请输入搜索关键词')" name="input" placeholder-style="color:#AAAAAA" style="width: 90%;"></input>
</view>
</view>
@@ -25,7 +25,7 @@
<view class="justify-content-item tn-text-center">
<!-- 没输入前-->
<tn-button backgroundColor="#3C97FF80" shape="round" padding="20rpx 20rpx" width="150rpx" @tap="">
<text class="tn-color-white">{{ t('searchButton') }}</text>
<text class="tn-color-white">{{ $tr('搜 索') }}</text>
</tn-button>
<!-- 输入后 -->
<!-- <tn-button backgroundColor="#3C97FF" shape="round" padding="20rpx 20rpx" width="150rpx" @tap="">
@@ -70,22 +70,6 @@
export default {
name: 'List',
mixins: [template_page_mixin],
i18n: {
zh: {
navTitle: '资料图库',
searchPlaceholder: '请输入搜索关键词',
searchButton: '搜 索',
galleryImage: '游戏攻略图',
galleryImageLong: '游戏攻略图游戏攻略图游戏攻略图'
},
en: {
navTitle: 'Gallery',
searchPlaceholder: 'Enter search keywords',
searchButton: 'Search',
galleryImage: 'Guide Image',
galleryImageLong: 'Guide Image Guide Image Guide Image'
}
},
data(){
return {
list: [
@@ -158,13 +142,10 @@
}
},
methods: {
t(key, params) {
return this.$tm('pkgExplore.download.download', key, params)
},
syncList() {
this.list = this.list.map((item, index) => ({
...item,
desc: index === 1 ? this.t('galleryImageLong') : this.t('galleryImage')
desc: index === 1 ? this.$tr('游戏攻略图游戏攻略图游戏攻略图') : this.$tr('游戏攻略图')
}))
},
// 跳转