mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 14:45:02 +08:00
cdb7ddc258
We updated version of moment and moment-timezone as our current versions are outdated making Discourse Dates broken on places where timezone had updates, like here in Brazil. This also update highlightJS to the latest version and corrected a test that relied on a no longer supported locale in moment.
128 lines
4.9 KiB
JavaScript
128 lines
4.9 KiB
JavaScript
//! moment.js locale configuration
|
||
//! locale : Serbian Cyrillic [sr-cyrl]
|
||
//! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
|
||
//! author : Stefan Crnjaković <stefan@hotmail.rs> : https://github.com/crnjakovic
|
||
|
||
;(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined'
|
||
&& typeof require === 'function' ? factory(require('../moment')) :
|
||
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
|
||
factory(global.moment)
|
||
}(this, (function (moment) { 'use strict';
|
||
|
||
//! moment.js locale configuration
|
||
|
||
var translator = {
|
||
words: {
|
||
//Different grammatical cases
|
||
ss: ['секунда', 'секунде', 'секунди'],
|
||
m: ['један минут', 'једне минуте'],
|
||
mm: ['минут', 'минуте', 'минута'],
|
||
h: ['један сат', 'једног сата'],
|
||
hh: ['сат', 'сата', 'сати'],
|
||
dd: ['дан', 'дана', 'дана'],
|
||
MM: ['месец', 'месеца', 'месеци'],
|
||
yy: ['година', 'године', 'година'],
|
||
},
|
||
correctGrammaticalCase: function (number, wordKey) {
|
||
return number === 1
|
||
? wordKey[0]
|
||
: number >= 2 && number <= 4
|
||
? wordKey[1]
|
||
: wordKey[2];
|
||
},
|
||
translate: function (number, withoutSuffix, key) {
|
||
var wordKey = translator.words[key];
|
||
if (key.length === 1) {
|
||
return withoutSuffix ? wordKey[0] : wordKey[1];
|
||
} else {
|
||
return (
|
||
number +
|
||
' ' +
|
||
translator.correctGrammaticalCase(number, wordKey)
|
||
);
|
||
}
|
||
},
|
||
};
|
||
|
||
var srCyrl = moment.defineLocale('sr-cyrl', {
|
||
months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split(
|
||
'_'
|
||
),
|
||
monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split(
|
||
'_'
|
||
),
|
||
monthsParseExact: true,
|
||
weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'),
|
||
weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'),
|
||
weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),
|
||
weekdaysParseExact: true,
|
||
longDateFormat: {
|
||
LT: 'H:mm',
|
||
LTS: 'H:mm:ss',
|
||
L: 'D. M. YYYY.',
|
||
LL: 'D. MMMM YYYY.',
|
||
LLL: 'D. MMMM YYYY. H:mm',
|
||
LLLL: 'dddd, D. MMMM YYYY. H:mm',
|
||
},
|
||
calendar: {
|
||
sameDay: '[данас у] LT',
|
||
nextDay: '[сутра у] LT',
|
||
nextWeek: function () {
|
||
switch (this.day()) {
|
||
case 0:
|
||
return '[у] [недељу] [у] LT';
|
||
case 3:
|
||
return '[у] [среду] [у] LT';
|
||
case 6:
|
||
return '[у] [суботу] [у] LT';
|
||
case 1:
|
||
case 2:
|
||
case 4:
|
||
case 5:
|
||
return '[у] dddd [у] LT';
|
||
}
|
||
},
|
||
lastDay: '[јуче у] LT',
|
||
lastWeek: function () {
|
||
var lastWeekDays = [
|
||
'[прошле] [недеље] [у] LT',
|
||
'[прошлог] [понедељка] [у] LT',
|
||
'[прошлог] [уторка] [у] LT',
|
||
'[прошле] [среде] [у] LT',
|
||
'[прошлог] [четвртка] [у] LT',
|
||
'[прошлог] [петка] [у] LT',
|
||
'[прошле] [суботе] [у] LT',
|
||
];
|
||
return lastWeekDays[this.day()];
|
||
},
|
||
sameElse: 'L',
|
||
},
|
||
relativeTime: {
|
||
future: 'за %s',
|
||
past: 'пре %s',
|
||
s: 'неколико секунди',
|
||
ss: translator.translate,
|
||
m: translator.translate,
|
||
mm: translator.translate,
|
||
h: translator.translate,
|
||
hh: translator.translate,
|
||
d: 'дан',
|
||
dd: translator.translate,
|
||
M: 'месец',
|
||
MM: translator.translate,
|
||
y: 'годину',
|
||
yy: translator.translate,
|
||
},
|
||
dayOfMonthOrdinalParse: /\d{1,2}\./,
|
||
ordinal: '%d.',
|
||
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.
|
||
},
|
||
});
|
||
|
||
return srCyrl;
|
||
|
||
})));
|