Initial commit of akmon project
This commit is contained in:
57
uni_modules/lime-dayuts/common/locale/en/index.ts
Normal file
57
uni_modules/lime-dayuts/common/locale/en/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// @ts-nocheck
|
||||
import type { DayutsLocale, DayutsRelativeTime} from '../../../utssdk/interface'
|
||||
/**
|
||||
* 英语本地化对象。
|
||||
*/
|
||||
export default {
|
||||
name: 'en',
|
||||
/**
|
||||
* 星期名称数组。
|
||||
*/
|
||||
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
||||
/**
|
||||
* 月份名称数组。
|
||||
*/
|
||||
months: [
|
||||
'January',
|
||||
'February',
|
||||
'March',
|
||||
'April',
|
||||
'May',
|
||||
'June',
|
||||
'July',
|
||||
'August',
|
||||
'September',
|
||||
'October',
|
||||
'November',
|
||||
'December',
|
||||
],
|
||||
relativeTime: {
|
||||
future: 'in %s',
|
||||
past: '%s ago',
|
||||
s: 'a few seconds',
|
||||
m: 'a minute',
|
||||
mm: '%d minutes',
|
||||
h: 'an hour',
|
||||
hh: '%d hours',
|
||||
d: 'a day',
|
||||
dd: '%d days',
|
||||
M: 'a month',
|
||||
MM: '%d months',
|
||||
y: 'a year',
|
||||
yy: '%d years'
|
||||
} as DayutsRelativeTime,
|
||||
/**
|
||||
* 序数函数,用于将数字转换为带有序数后缀的字符串。
|
||||
*
|
||||
* @param {number} n - 要转换的数字。
|
||||
* @returns {string} 带有序数后缀的字符串。
|
||||
*/
|
||||
ordinal: (n : number, _ : string) : string => {
|
||||
const s = ['th', 'st', 'nd', 'rd']
|
||||
const v = n % 100
|
||||
const i = (v - 20) % 10
|
||||
const k = i < s.length ? i : v < s.length ? v : 0
|
||||
return `[${n}${(s[k])}]`
|
||||
},
|
||||
} as DayutsLocale
|
||||
75
uni_modules/lime-dayuts/common/locale/zh-cn/index.ts
Normal file
75
uni_modules/lime-dayuts/common/locale/zh-cn/index.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
// @ts-nocheck
|
||||
import type { DayutsLocale, DayutsRelativeTime, DayutsFormats } from '../../../utssdk/interface'
|
||||
|
||||
const locale : DayutsLocale = {
|
||||
name: 'zh-cn',
|
||||
weekdays: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
|
||||
weekdaysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
||||
weekdaysMin: ['日', '一', '二', '三', '四', '五', '六'],
|
||||
months: [
|
||||
'一月', '二月', '三月', '四月', '五月', '六月',
|
||||
'七月', '八月', '九月', '十月', '十一月', '十二月'
|
||||
],
|
||||
monthsShort: [
|
||||
'1月', '2月', '3月', '4月', '5月', '6月',
|
||||
'7月', '8月', '9月', '10月', '11月', '12月'
|
||||
],
|
||||
ordinal: (number:number, period:string):string => {
|
||||
// switch (period) {
|
||||
// case 'W':
|
||||
// return `${number}周`;
|
||||
// default:
|
||||
// return `${number}日`;
|
||||
// }
|
||||
if(period == 'W'){
|
||||
return `${number}周`;
|
||||
}
|
||||
return `${number}日`
|
||||
},
|
||||
weekStart: 1,
|
||||
yearStart: 4,
|
||||
formats: {
|
||||
LT: 'HH:mm',
|
||||
LTS: 'HH:mm:ss',
|
||||
L: 'YYYY/MM/DD',
|
||||
LL: 'YYYY年M月D日',
|
||||
LLL: 'YYYY年M月D日Ah点mm分',
|
||||
LLLL: 'YYYY年M月D日ddddAh点mm分',
|
||||
l: 'YYYY/M/D',
|
||||
ll: 'YYYY年M月D日',
|
||||
lll: 'YYYY年M月D日 HH:mm',
|
||||
llll: 'YYYY年M月D日dddd HH:mm'
|
||||
} as DayutsFormats,
|
||||
relativeTime: {
|
||||
future: '%s内',
|
||||
past: '%s前',
|
||||
s: '几秒',
|
||||
m: '1 分钟',
|
||||
mm: '%d 分钟',
|
||||
h: '1 小时',
|
||||
hh: '%d 小时',
|
||||
d: '1 天',
|
||||
dd: '%d 天',
|
||||
M: '1 个月',
|
||||
MM: '%d 个月',
|
||||
y: '1 年',
|
||||
yy: '%d 年'
|
||||
} as DayutsRelativeTime,
|
||||
meridiem: (hour:number, minute:number, _ : boolean):string => {
|
||||
const hm = (hour * 100) + minute;
|
||||
if (hm < 600) {
|
||||
return '凌晨';
|
||||
} else if (hm < 900) {
|
||||
return '早上';
|
||||
} else if (hm < 1100) {
|
||||
return '上午';
|
||||
} else if (hm < 1300) {
|
||||
return '中午';
|
||||
} else if (hm < 1800) {
|
||||
return '下午';
|
||||
}
|
||||
return '晚上';
|
||||
}
|
||||
};
|
||||
|
||||
export default locale;
|
||||
Reference in New Issue
Block a user