//! moment.js locale configuration
//! locale : Ukrainian [uk]
//! author : zemlanin : https://github.com/zemlanin
//! Author : Menelion Elensúle : https://github.com/Oire
import moment from '../moment';
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
'mm': withoutSuffix ? '???????_???????_??????' : '???????_???????_??????',
'hh': withoutSuffix ? '??????_??????_?????' : '??????_??????_?????',
'dd': '????_???_????',
'MM': '??????_??????_???????',
'yy': '???_????_?????'
};
if (key === 'm') {
return withoutSuffix ? '???????' : '???????';
}
else if (key === 'h') {
return withoutSuffix ? '??????' : '??????';
}
else {
return number + ' ' + plural(format[key], +number);
}
}
function weekdaysCaseReplace(m, format) {
var weekdays = {
'nominative': '??????_?????????_????????_??????_??????_????????_??????'.split('_'),
'accusative': '??????_?????????_????????_??????_??????_????????_??????'.split('_'),
'genitive': '??????_?????????_????????_??????_????????_????????_??????'.split('_')
};
if (!m) {
return weekdays['nominative'];
}
var nounCase = (/(\[[????]\]) ?dddd/).test(format) ?
'accusative' :
((/\[?(?:???????|?????????)? ?\] ?dddd/).test(format) ?
'genitive' :
'nominative');
return weekdays[nounCase][m.day()];
}
function processHoursFunction(str) {
return function () {
return str + '?' + (this.hours() === 11 ? '?' : '') + '] LT';
};
}
export default moment.defineLocale('uk', {
months : {
'format': '?????_??????_???????_??????_??????_??????_?????_??????_???????_??????_?????????_??????'.split('_'),
'standalone': '??????_?????_????????_???????_???????_???????_??????_???????_????????_???????_????????_???????'.split('_')
},
monthsShort : '???_???_???_????_????_????_???_????_???_????_????_????'.split('_'),
weekdays : weekdaysCaseReplace,
weekdaysShort : '??_??_??_??_??_??_??'.split('_'),
weekdaysMin : '??_??_??_??_??_??_??'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY ?.',
LLL : 'D MMMM YYYY ?., HH:mm',
LLLL : 'dddd, D MMMM YYYY ?., HH:mm'
},
calendar : {
sameDay: processHoursFunction('[???????? '),
nextDay: processHoursFunction('[?????? '),
lastDay: processHoursFunction('[????? '),
nextWeek: processHoursFunction('[?] dddd ['),
lastWeek: function () {
switch (this.day()) {
case 0:
case 3:
case 5:
case 6:
return processHoursFunction('[???????] dddd [').call(this);
case 1:
case 2:
case 4:
return processHoursFunction('[????????] dddd [').call(this);
}
},
sameElse: 'L'
},
relativeTime : {
future : '?? %s',
past : '%s ????',
s : '???????? ??????',
m : relativeTimeWithPlural,
mm : relativeTimeWithPlural,
h : '??????',
hh : relativeTimeWithPlural,
d : '????',
dd : relativeTimeWithPlural,
M : '??????',
MM : relativeTimeWithPlural,
y : '???',
yy : relativeTimeWithPlural
},
// M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
meridiemParse: /????|?????|???|??????/,
isPM: function (input) {
return /^(???|??????)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return '????';
} else if (hour < 12) {
return '?????';
} else if (hour < 17) {
return '???';
} else {
return '??????';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(?|??)/,
ordinal: function (number, period) {
switch (period) {
case 'M':
case 'd':
case 'DDD':
case 'w':
case 'W':
return number + '-?';
case 'D':
return number + '-??';
default:
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
|