feat: add and optimize multilingual text resources
- add new language packs for multiple pages and components including category, cart, order, member center, distribution, etc. - add Chinese and English translations for new features and UI text - fix navigation service error message to use multilingual text - update component templates to use dynamic language translation instead of hardcoded text - adjust code indentation and formatting for consistency
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
import Lang from '@/common/js/lang.js';
|
||||
|
||||
// 内部翻译函数封装(组件级工具函数直接调用语言包)
|
||||
function $lang(key, ...args) {
|
||||
return Lang.lang(key, ...args);
|
||||
}
|
||||
|
||||
//字符串拼接
|
||||
export function strFormat(str) {
|
||||
return str < 10 ? `0${str}` : str
|
||||
@@ -31,11 +38,19 @@ export function timeStamp(time) {
|
||||
const day = dates.getDay()
|
||||
const hour = dates.getHours()
|
||||
const min = dates.getMinutes()
|
||||
const days = ['日', '一', '二', '三', '四', '五', '六']
|
||||
const weekDays = [
|
||||
$lang('components.yuyueDate.weekSunday'),
|
||||
$lang('components.yuyueDate.weekMonday'),
|
||||
$lang('components.yuyueDate.weekTuesday'),
|
||||
$lang('components.yuyueDate.weekWednesday'),
|
||||
$lang('components.yuyueDate.weekThursday'),
|
||||
$lang('components.yuyueDate.weekFriday'),
|
||||
$lang('components.yuyueDate.weekSaturday'),
|
||||
]
|
||||
return {
|
||||
allDate: `${year}/${strFormat(month)}/${strFormat(date)}`,
|
||||
date: `${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01,${strFormat(year)}-${strFormat(month)}-${strFormat(date)}
|
||||
day: `周${days[day]}`, //返回的礼拜天数 星期一
|
||||
day: weekDays[day], //返回的礼拜天数 星期一
|
||||
hour: strFormat(hour) + ':' + strFormat(min) // + ':00' //返回的时钟 08:00
|
||||
}
|
||||
}
|
||||
@@ -48,9 +63,9 @@ export function initData(appointedDay = '') {
|
||||
const now = date.getTime() //获取当前日期的时间戳
|
||||
let timeStr = 3600 * 24 * 1000 //一天的时间戳
|
||||
let obj = {
|
||||
0: "今天",
|
||||
1: "明天",
|
||||
2: "后天"
|
||||
0: $lang('components.yuyueDate.today'),
|
||||
1: $lang('components.yuyueDate.tomorrow'),
|
||||
2: $lang('components.yuyueDate.dayAfterTomorrow')
|
||||
}
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const timeObj = {}
|
||||
|
||||
Reference in New Issue
Block a user