123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var eraValues = {
- narrow: ['前', '公元'],
- abbreviated: ['前', '公元'],
- wide: ['公元前', '公元']
- };
- var quarterValues = {
- narrow: ['1', '2', '3', '4'],
- abbreviated: ['第一刻', '第二刻', '第三刻', '第四刻'],
- wide: ['第一刻钟', '第二刻钟', '第三刻钟', '第四刻钟']
- };
- var monthValues = {
- narrow: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
- abbreviated: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- wide: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
- };
- var dayValues = {
- narrow: ['日', '一', '二', '三', '四', '五', '六'],
- short: ['日', '一', '二', '三', '四', '五', '六'],
- abbreviated: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
- wide: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
- };
- var dayPeriodValues = {
- narrow: {
- am: '上',
- pm: '下',
- midnight: '凌晨',
- noon: '午',
- morning: '早',
- afternoon: '下午',
- evening: '晚',
- night: '夜'
- },
- abbreviated: {
- am: '上午',
- pm: '下午',
- midnight: '凌晨',
- noon: '中午',
- morning: '早晨',
- afternoon: '中午',
- evening: '晚上',
- night: '夜间'
- },
- wide: {
- am: '上午',
- pm: '下午',
- midnight: '凌晨',
- noon: '中午',
- morning: '早晨',
- afternoon: '中午',
- evening: '晚上',
- night: '夜间'
- }
- };
- var formattingDayPeriodValues = {
- narrow: {
- am: '上',
- pm: '下',
- midnight: '凌晨',
- noon: '午',
- morning: '早',
- afternoon: '下午',
- evening: '晚',
- night: '夜'
- },
- abbreviated: {
- am: '上午',
- pm: '下午',
- midnight: '凌晨',
- noon: '中午',
- morning: '早晨',
- afternoon: '中午',
- evening: '晚上',
- night: '夜间'
- },
- wide: {
- am: '上午',
- pm: '下午',
- midnight: '凌晨',
- noon: '中午',
- morning: '早晨',
- afternoon: '中午',
- evening: '晚上',
- night: '夜间'
- }
- };
- function ordinalNumber(dirtyNumber, dirtyOptions) {
- // If ordinal numbers depend on context, for example,
- // if they are different for different grammatical genders,
- // use `options.unit`:
- //
- // var options = dirtyOptions || {}
- // var unit = String(options.unit)
- //
- // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
- // 'day', 'hour', 'minute', 'second'
- var number = Number(dirtyNumber);
- var options = dirtyOptions || {};
- var unit = String(options.unit);
- switch (unit) {
- case 'date':
- return number.toString() + '日';
- case 'hour':
- return number.toString() + '时';
- case 'minute':
- return number.toString() + '分';
- case 'second':
- return number.toString() + '秒';
- default:
- return '第 ' + number.toString();
- }
- }
- var localize = {
- ordinalNumber: ordinalNumber,
- era: (0, _index.default)({
- values: eraValues,
- defaultWidth: 'wide'
- }),
- quarter: (0, _index.default)({
- values: quarterValues,
- defaultWidth: 'wide',
- argumentCallback: function (quarter) {
- return Number(quarter) - 1;
- }
- }),
- month: (0, _index.default)({
- values: monthValues,
- defaultWidth: 'wide'
- }),
- day: (0, _index.default)({
- values: dayValues,
- defaultWidth: 'wide'
- }),
- dayPeriod: (0, _index.default)({
- values: dayPeriodValues,
- defaultWidth: 'wide',
- formattingValues: formattingDayPeriodValues,
- defaultFormattingWidth: 'wide'
- })
- };
- var _default = localize;
- exports.default = _default;
- module.exports = exports.default;
|