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

@@ -23,7 +23,7 @@ export function currentTime() {
}
//时间戳转日期
export function timeStamp(time) {
export function timeStamp(time, dayNames) {
const dates = new Date(time)
const year = dates.getFullYear()
const month = dates.getMonth() + 1
@@ -31,32 +31,33 @@ export function timeStamp(time) {
const day = dates.getDay()
const hour = dates.getHours()
const min = dates.getMinutes()
const days = ['日', '一', '二', '三', '四', '五', '六']
const days = dayNames || ['日', '一', '二', '三', '四', '五', '六']
return {
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
date: `${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01,${strFormat(year)}-${strFormat(month)}-${strFormat(date)}
day: `周${days[day]}`, //返回的礼拜天数 星期一
day: `${days[day]}`, //返回的礼拜天数 星期一
hour: strFormat(hour) + ':' + strFormat(min) // + ':00' //返回的时钟 08:00
}
}
//获取最近7天的日期和礼拜天数
export function initData(appointedDay = '') {
export function initData(appointedDay = '', dayNames) {
const time = []
const date = appointedDay ? new Date(appointedDay) : new Date()
const now = date.getTime() //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000 //一天的时间戳
const defaults = dayNames || { today: "今天", tomorrow: "明天", dayAfterTomorrow: "后天" }
let obj = {
0: "今天",
1: "明天",
2: "后天"
0: defaults.today,
1: defaults.tomorrow,
2: defaults.dayAfterTomorrow
}
for (let i = 0; i < 7; i++) {
const timeObj = {}
timeObj.date = timeStamp(now + timeStr * i).date //保存日期
timeObj.date = timeStamp(now + timeStr * i, dayNames).date //保存日期
timeObj.timeStamp = now + timeStr * i //保存时间戳
timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i).day) : timeStamp(now + timeStr * i)
timeObj.week = appointedDay == '' ? (obj[i] ?? timeStamp(now + timeStr * i, dayNames).day) : timeStamp(now + timeStr * i, dayNames)
.day
time.push(timeObj)
}