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:
@@ -6,7 +6,7 @@
|
||||
<view class="loading-logo">
|
||||
<text class="tn-icon-moon tn-color-white" style="font-size: 80rpx; transform: rotate(-45deg); display: block;"></text>
|
||||
</view>
|
||||
<view class="loading-desc tn-margin-top-lg" style="color: rgba(255,255,255,0.8); letter-spacing: 4rpx; font-size: 32rpx; font-weight: bold;">{{ t('loadingBrand') }}</view>
|
||||
<view class="loading-desc tn-margin-top-lg" style="color: rgba(255,255,255,0.8); letter-spacing: 4rpx; font-size: 32rpx; font-weight: bold;">{{ $tr('绿居公寓') }}</view>
|
||||
<view class="loading-spinner tn-margin-top-xl">
|
||||
<tn-loading mode="circle" color="#00BBE8" size="60"></tn-loading>
|
||||
</view>
|
||||
@@ -15,21 +15,21 @@
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view v-if="showPrivacyPopup" class="privacy-mask">
|
||||
<view class="privacy-dialog">
|
||||
<view class="privacy-title">{{ t('privacyTitle') }}</view>
|
||||
<view class="privacy-title">{{ $tr('隐私授权提示') }}</view>
|
||||
<view class="privacy-content">
|
||||
{{ t('privacyContentPrefix') }}
|
||||
<text class="privacy-link" @click="openPrivacyContract">{{ t('privacyContractName') }}</text>
|
||||
{{ t('privacyContentSuffix') }}
|
||||
{{ $tr('进入小程序前,请先阅读并同意') }}
|
||||
<text class="privacy-link" @click="openPrivacyContract">{{ $tr('《用户隐私保护指引》') }}</text>
|
||||
{{ $tr(',同意后才能继续使用相关功能。') }}
|
||||
</view>
|
||||
<view class="privacy-action-row">
|
||||
<view class="privacy-action-btn" @click="handlePrivacyDisagree">{{ t('privacyDisagree') }}</view>
|
||||
<view class="privacy-action-btn" @click="handlePrivacyDisagree">{{ $tr('暂不授权') }}</view>
|
||||
<button
|
||||
id="index-privacy-agree-btn"
|
||||
class="privacy-action-btn is-primary"
|
||||
open-type="agreePrivacyAuthorization"
|
||||
@agreeprivacyauthorization="handleAgreePrivacyAuthorization"
|
||||
>
|
||||
{{ t('privacyAgree') }}
|
||||
{{ $tr('同意并继续') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -156,50 +156,18 @@
|
||||
pendingContracts: []
|
||||
},
|
||||
tabDefinitions: [
|
||||
{ id: 'select-room', labelKey: 'tabSelectRoom', icon: 'tn-icon-home-fill', image: '/static/tabbar/tn-tabbar0.png', component: 'SelectRoomTab', ref: 'selectRoomTab', refreshMethod: 'checkLoginStatus' },
|
||||
{ id: 'stay-service', labelKey: 'tabStayService', icon: 'tn-icon-safe', image: '/static/tabbar/tn-tabbar1.png', component: 'StayServiceTab', ref: 'stayServiceTab', refreshMethod: 'checkLocalStatus' },
|
||||
{ id: 'my-application', labelKey: 'tabMyApplication', icon: 'tn-icon-order', image: '/static/tabbar/tn-tabbar2.png', component: 'MyApplicationTab', ref: 'myApplicationTab', refreshMethod: 'load' },
|
||||
{ id: 'message-center', labelKey: 'tabMessageCenter', icon: 'tn-icon-message', image: '/static/tabbar/tn-tabbar3.png', component: 'MessageCenterTab', ref: 'messageCenterTab', refreshMethod: 'load' },
|
||||
{ id: 'profile-center', labelKey: 'tabProfileCenter', icon: 'tn-icon-my-fill', image: '/static/tabbar/tn-tabbar3.png', component: 'ProfileCenterTab', ref: 'profileCenterTab', refreshMethod: 'checkLoginStatus' }
|
||||
{ id: 'select-room', labelKey: '选 房', icon: 'tn-icon-home-fill', image: '/static/tabbar/tn-tabbar0.png', component: 'SelectRoomTab', ref: 'selectRoomTab', refreshMethod: 'checkLoginStatus' },
|
||||
{ id: 'stay-service', labelKey: '入 住', icon: 'tn-icon-safe', image: '/static/tabbar/tn-tabbar1.png', component: 'StayServiceTab', ref: 'stayServiceTab', refreshMethod: 'checkLocalStatus' },
|
||||
{ id: 'my-application', labelKey: '申请单', icon: 'tn-icon-order', image: '/static/tabbar/tn-tabbar2.png', component: 'MyApplicationTab', ref: 'myApplicationTab', refreshMethod: 'load' },
|
||||
{ id: 'message-center', labelKey: '消 息', icon: 'tn-icon-message', image: '/static/tabbar/tn-tabbar3.png', component: 'MessageCenterTab', ref: 'messageCenterTab', refreshMethod: 'load' },
|
||||
{ id: 'profile-center', labelKey: '我 的', icon: 'tn-icon-my-fill', image: '/static/tabbar/tn-tabbar3.png', component: 'ProfileCenterTab', ref: 'profileCenterTab', refreshMethod: 'checkLoginStatus' }
|
||||
],
|
||||
loadedPages: ['select-room'],
|
||||
isAppInitLoading: true,
|
||||
isTabSwitching: false,
|
||||
showPrivacyPopup: false,
|
||||
resolvePrivacyAuthorization: null,
|
||||
isCheckingPrivacyAuthorization: false,
|
||||
i18n: {
|
||||
zh: {
|
||||
loadingBrand: '绿居公寓',
|
||||
shareTitle: '绿居公寓 - 国际化青年社区',
|
||||
tabSelectRoom: '选 房',
|
||||
tabStayService: '入 住',
|
||||
tabMyApplication: '申请单',
|
||||
tabMessageCenter: '消 息',
|
||||
tabProfileCenter: '我 的',
|
||||
privacyTitle: '隐私授权提示',
|
||||
privacyContentPrefix: '进入小程序前,请先阅读并同意',
|
||||
privacyContractName: '《用户隐私保护指引》',
|
||||
privacyContentSuffix: ',同意后才能继续使用相关功能。',
|
||||
privacyAgree: '同意并继续',
|
||||
privacyDisagree: '暂不授权'
|
||||
},
|
||||
en: {
|
||||
loadingBrand: 'Luju Apartments',
|
||||
shareTitle: 'Luju Apartments - International Youth Community',
|
||||
tabSelectRoom: 'Explore',
|
||||
tabStayService: 'Stay',
|
||||
tabMyApplication: 'Applications',
|
||||
tabMessageCenter: 'Messages',
|
||||
tabProfileCenter: 'Profile',
|
||||
privacyTitle: 'Privacy Authorization',
|
||||
privacyContentPrefix: 'Before entering the mini program, please read and agree to the ',
|
||||
privacyContractName: 'Privacy Protection Guide',
|
||||
privacyContentSuffix: ' to continue using related features.',
|
||||
privacyAgree: 'Agree and Continue',
|
||||
privacyDisagree: 'Not Now'
|
||||
}
|
||||
}
|
||||
isCheckingPrivacyAuthorization: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -231,7 +199,7 @@
|
||||
.filter(item => this.visibleTabIds.includes(item.id))
|
||||
.map(item => ({
|
||||
...item,
|
||||
name: this.t(item.labelKey)
|
||||
name: this.$tr(item.labelKey)
|
||||
}))
|
||||
},
|
||||
currentTabbarIndex() {
|
||||
@@ -262,9 +230,6 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
t(key) {
|
||||
return this.$tm('pages.index.index', key)
|
||||
},
|
||||
initPrivacyAuthorization() {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (typeof wx === 'undefined' || !wx.onNeedPrivacyAuthorization) {
|
||||
@@ -782,14 +747,14 @@
|
||||
// 分享到朋友
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.t('shareTitle'),
|
||||
title: this.$tr('绿居公寓 - 国际化青年社区'),
|
||||
path: '/pages/index/index'
|
||||
}
|
||||
},
|
||||
// 分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.t('shareTitle')
|
||||
title: this.$tr('绿居公寓 - 国际化青年社区')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user