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

@@ -6,10 +6,10 @@
<template v-if="hasPrice">
<text class="price-symbol">¥</text>
<text class="price-value">{{ detailData.priceValue }}</text>
<text class="price-unit">{{ t('priceUnit') }}</text>
<text class="price-unit">{{ $tr('/月') }}</text>
</template>
<template v-else>
<text class="price-empty">{{ t('pricePending') }}</text>
<text class="price-empty">{{ $tr('待定') }}</text>
</template>
</view>
@@ -40,7 +40,7 @@
<view class="address-info">
<view class="address-text tn-text-ellipsis">{{ shortAddress }}</view>
<view class="address-sub tn-flex tn-flex-col-center">
<text class="address-sub-text">{{ t('addressHint') }}</text>
<text class="address-sub-text">{{ $tr('查看地图位置') }}</text>
<text class="tn-icon-right address-sub-icon"></text>
</view>
</view>
@@ -48,7 +48,7 @@
<view class="address-right">
<view class="nav-btn tn-flex tn-flex-row-center tn-flex-col-center">
<text class="tn-icon-navigation-fill"></text>
<text class="nav-text">{{ t('navigate') }}</text>
<text class="nav-text">{{ $tr('导航') }}</text>
</view>
</view>
</view>
@@ -91,19 +91,16 @@ export default {
shortAddress() {
const addr = this.displayAddress;
if (!addr) {
return this.t('noAddress')
return this.$tr('暂无地址')
}
if (this.language === 'en') {
return addr
}
const short = addr.replace(/^(?:.*?省|.*?自治区)?(?:.*?市|.*?自治州)?/, '');
return short.trim() ? short : (addr || this.t('noAddress'));
return short.trim() ? short : (addr || this.$tr('暂无地址'));
}
},
methods: {
t(key) {
return this.$tm('pkgExplore.room_detail.room_detail', key)
},
handleAddressClick() {
this.$emit('open-map', this.detailData)
}