i18n: 替换所有硬编码文本为多语言配置

将项目中各处的硬编码字符串替换为国际化语言包调用,统一管理页面和组件的文案内容,方便后续多语言适配与维护
This commit is contained in:
2026-06-22 17:53:38 +08:00
parent 47098bddda
commit 4715f06b2f
19 changed files with 109 additions and 100 deletions

View File

@@ -173,7 +173,7 @@
return {
pickerStartDay: '', // 指定开始日期
pickerEndDay: '', // 指定结束日期
orderDateTime: '暂无选择', // 选中时间
orderDateTime: this.$lang('date.noSelection'), // 选中时间
orderTimeArr: {}, //多选的时间
dateArr: [], //日期数据
timeArr: [], //时间数据
@@ -188,14 +188,16 @@
};
},
created(props) {
const dayNames = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
const dayLabels = { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') };
this.selectDate = this.nowDate = currentTime().date;
this.pickerStartDay = currentTime().year + '-' + currentTime().date;
const now = new Date(this.pickerStartDay).getTime(); //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000; //一天的时间戳
let day = 90; // 未来3个月
this.pickerEndDay = timeStamp(now + timeStr * day).allDate;
this.pickerEndDay = timeStamp(now + timeStr * day, dayNames).allDate;
this.initOnload();
this.dateArr = initData(); // 日期栏初始化
this.dateArr = initData('', dayLabels); // 日期栏初始化
},
methods: {
open() {
@@ -209,18 +211,18 @@
let date = e.split("-");
date = date[1] + "-" + date[2];
if (this.disableWeek.length && date >= weekDate()[0] && date <= weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let index = new Date(e).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({
title: weekBox[index] + '不可以预约',
title: weekBox[index] + this.$lang('date.cannotReserve'),
icon: 'none'
})
return false;
}
}
this.initOnload(e);
this.dateArr = initData(e); // 日期栏初始化
this.dateArr = initData(e, { today: this.$lang('date.today'), tomorrow: this.$lang('date.tomorrow'), dayAfterTomorrow: this.$lang('date.dayAfterTomorrow') }); // 日期栏初始化
this.selectDateEvent(0, this.dateArr[0]);
},
initOnload(appointedDay) {
@@ -231,7 +233,7 @@
// 判断默认是不能选择的周,则都禁止选中
if (this.disableWeek.length && this.selectDate >= weekDate()[0] && this.selectDate <=
weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let date = currentTime().year + '-' + this.selectDate;
let index = new Date(date).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
@@ -280,7 +282,7 @@
this.isSection && (item.isInclude = false);
});
this.orderDateTime = isFullTime ? '暂无选择' : this.selectDate;
this.orderDateTime = isFullTime ? this.$lang('date.noSelection') : this.selectDate;
this.timeActive = -1;
for (let i = 0, len = this.timeArr.length; i < len; i++) {
if (!this.timeArr[i].disable) {
@@ -297,11 +299,11 @@
// 日期选择事件
selectDateEvent(index, item) {
if (this.disableWeek.length && item.date >= weekDate()[0] && item.date <= weekDate()[1]) {
let weekBox = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
let weekBox = [this.$lang('date.sunday'), this.$lang('date.monday'), this.$lang('date.tuesday'), this.$lang('date.wednesday'), this.$lang('date.thursday'), this.$lang('date.friday'), this.$lang('date.saturday')];
let index = new Date(item.timeStamp).getDay();
if (this.disableWeek.indexOf(weekBox[index]) != -1) {
uni.showToast({
title: weekBox[index] + '不可以预约',
title: weekBox[index] + this.$lang('date.cannotReserve'),
icon: 'none'
})
return false;