mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Upgrade moment.js to latest version, add missing locales now that we
support more languages.
This commit is contained in:
105
lib/javascripts/moment_locale/sr.js
Normal file
105
lib/javascripts/moment_locale/sr.js
Normal file
@ -0,0 +1,105 @@
|
||||
// moment.js locale configuration
|
||||
// locale : Serbian-latin (sr)
|
||||
// author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['moment'], factory); // AMD
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory(require('../moment')); // Node
|
||||
} else {
|
||||
factory(window.moment); // Browser global
|
||||
}
|
||||
}(function (moment) {
|
||||
var translator = {
|
||||
words: { //Different grammatical cases
|
||||
m: ['jedan minut', 'jedne minute'],
|
||||
mm: ['minut', 'minute', 'minuta'],
|
||||
h: ['jedan sat', 'jednog sata'],
|
||||
hh: ['sat', 'sata', 'sati'],
|
||||
dd: ['dan', 'dana', 'dana'],
|
||||
MM: ['mesec', 'meseca', 'meseci'],
|
||||
yy: ['godina', 'godine', 'godina']
|
||||
},
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return moment.defineLocale('sr', {
|
||||
months: ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'],
|
||||
monthsShort: ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'],
|
||||
weekdays: ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'],
|
||||
weekdaysShort: ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'],
|
||||
weekdaysMin: ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'],
|
||||
longDateFormat: {
|
||||
LT: "H:mm",
|
||||
L: "DD. MM. YYYY",
|
||||
LL: "D. MMMM YYYY",
|
||||
LLL: "D. MMMM YYYY LT",
|
||||
LLLL: "dddd, D. MMMM YYYY LT"
|
||||
},
|
||||
calendar: {
|
||||
sameDay: '[danas u] LT',
|
||||
nextDay: '[sutra u] LT',
|
||||
|
||||
nextWeek: function () {
|
||||
switch (this.day()) {
|
||||
case 0:
|
||||
return '[u] [nedelju] [u] LT';
|
||||
case 3:
|
||||
return '[u] [sredu] [u] LT';
|
||||
case 6:
|
||||
return '[u] [subotu] [u] LT';
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
return '[u] dddd [u] LT';
|
||||
}
|
||||
},
|
||||
lastDay : '[juče u] LT',
|
||||
lastWeek : function () {
|
||||
var lastWeekDays = [
|
||||
'[prošle] [nedelje] [u] LT',
|
||||
'[prošlog] [ponedeljka] [u] LT',
|
||||
'[prošlog] [utorka] [u] LT',
|
||||
'[prošle] [srede] [u] LT',
|
||||
'[prošlog] [četvrtka] [u] LT',
|
||||
'[prošlog] [petka] [u] LT',
|
||||
'[prošle] [subote] [u] LT'
|
||||
];
|
||||
return lastWeekDays[this.day()];
|
||||
},
|
||||
sameElse : 'L'
|
||||
},
|
||||
relativeTime : {
|
||||
future : "za %s",
|
||||
past : "pre %s",
|
||||
s : "nekoliko sekundi",
|
||||
m : translator.translate,
|
||||
mm : translator.translate,
|
||||
h : translator.translate,
|
||||
hh : translator.translate,
|
||||
d : "dan",
|
||||
dd : translator.translate,
|
||||
M : "mesec",
|
||||
MM : translator.translate,
|
||||
y : "godinu",
|
||||
yy : translator.translate
|
||||
},
|
||||
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.
|
||||
}
|
||||
});
|
||||
}));
|
Reference in New Issue
Block a user