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:
@@ -8,7 +8,7 @@
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="date-divider">{{ t('dateDivider') }}</view>
|
||||
<view class="date-divider">{{ $tr('至') }}</view>
|
||||
<view class="date-item">
|
||||
<view class="date-label">{{ resolvedEndLabel }}</view>
|
||||
<picker mode="date" @change="onEndChange">
|
||||
@@ -23,22 +23,6 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'DateRangeSelector',
|
||||
i18n: {
|
||||
zh: {
|
||||
startLabel: '预计入住',
|
||||
endLabel: '预计离开',
|
||||
startPlaceholder: '请选择入住日期',
|
||||
endPlaceholder: '请选择离开日期',
|
||||
dateDivider: '至'
|
||||
},
|
||||
en: {
|
||||
startLabel: 'Expected Check-in',
|
||||
endLabel: 'Expected Check-out',
|
||||
startPlaceholder: 'Select check-in date',
|
||||
endPlaceholder: 'Select check-out date',
|
||||
dateDivider: 'to'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
start: {
|
||||
type: String,
|
||||
@@ -67,22 +51,19 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
resolvedStartLabel() {
|
||||
return this.startLabel || this.t('startLabel')
|
||||
return this.startLabel || this.$tr('预计入住')
|
||||
},
|
||||
resolvedEndLabel() {
|
||||
return this.endLabel || this.t('endLabel')
|
||||
return this.endLabel || this.$tr('预计离开')
|
||||
},
|
||||
resolvedStartPlaceholder() {
|
||||
return this.startPlaceholder || this.t('startPlaceholder')
|
||||
return this.startPlaceholder || this.$tr('请选择入住日期')
|
||||
},
|
||||
resolvedEndPlaceholder() {
|
||||
return this.endPlaceholder || this.t('endPlaceholder')
|
||||
return this.endPlaceholder || this.$tr('请选择离开日期')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
t(key) {
|
||||
return this.$tm('pkgService.submit_request.components.DateRangeSelector', key)
|
||||
},
|
||||
onStartChange(e) {
|
||||
this.$emit('update:start', e.detail.value)
|
||||
},
|
||||
@@ -128,7 +109,7 @@ export default {
|
||||
font-size: 28rpx;
|
||||
color: #1A2B4C;
|
||||
font-weight: 600;
|
||||
|
||||
|
||||
&.is-empty {
|
||||
color: #CBD5E1;
|
||||
font-weight: normal;
|
||||
|
||||
Reference in New Issue
Block a user