sr.js (4209B)
1//! moment.js locale configuration 2//! locale : Serbian [sr] 3//! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j 4//! author : Stefan Crnjaković <stefan@hotmail.rs> : https://github.com/crnjakovic 5 6import moment from '../moment'; 7 8var translator = { 9 words: { 10 //Different grammatical cases 11 ss: ['sekunda', 'sekunde', 'sekundi'], 12 m: ['jedan minut', 'jednog minuta'], 13 mm: ['minut', 'minuta', 'minuta'], 14 h: ['jedan sat', 'jednog sata'], 15 hh: ['sat', 'sata', 'sati'], 16 d: ['jedan dan', 'jednog dana'], 17 dd: ['dan', 'dana', 'dana'], 18 M: ['jedan mesec', 'jednog meseca'], 19 MM: ['mesec', 'meseca', 'meseci'], 20 y: ['jednu godinu', 'jedne godine'], 21 yy: ['godinu', 'godine', 'godina'], 22 }, 23 correctGrammaticalCase: function (number, wordKey) { 24 if ( 25 number % 10 >= 1 && 26 number % 10 <= 4 && 27 (number % 100 < 10 || number % 100 >= 20) 28 ) { 29 return number % 10 === 1 ? wordKey[0] : wordKey[1]; 30 } 31 return wordKey[2]; 32 }, 33 translate: function (number, withoutSuffix, key, isFuture) { 34 var wordKey = translator.words[key], 35 word; 36 37 if (key.length === 1) { 38 // Nominativ 39 if (key === 'y' && withoutSuffix) return 'jedna godina'; 40 return isFuture || withoutSuffix ? wordKey[0] : wordKey[1]; 41 } 42 43 word = translator.correctGrammaticalCase(number, wordKey); 44 // Nominativ 45 if (key === 'yy' && withoutSuffix && word === 'godinu') { 46 return number + ' godina'; 47 } 48 49 return number + ' ' + word; 50 }, 51}; 52 53export default moment.defineLocale('sr', { 54 months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split( 55 '_' 56 ), 57 monthsShort: 58 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), 59 monthsParseExact: true, 60 weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split( 61 '_' 62 ), 63 weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), 64 weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), 65 weekdaysParseExact: true, 66 longDateFormat: { 67 LT: 'H:mm', 68 LTS: 'H:mm:ss', 69 L: 'D. M. YYYY.', 70 LL: 'D. MMMM YYYY.', 71 LLL: 'D. MMMM YYYY. H:mm', 72 LLLL: 'dddd, D. MMMM YYYY. H:mm', 73 }, 74 calendar: { 75 sameDay: '[danas u] LT', 76 nextDay: '[sutra u] LT', 77 nextWeek: function () { 78 switch (this.day()) { 79 case 0: 80 return '[u] [nedelju] [u] LT'; 81 case 3: 82 return '[u] [sredu] [u] LT'; 83 case 6: 84 return '[u] [subotu] [u] LT'; 85 case 1: 86 case 2: 87 case 4: 88 case 5: 89 return '[u] dddd [u] LT'; 90 } 91 }, 92 lastDay: '[juče u] LT', 93 lastWeek: function () { 94 var lastWeekDays = [ 95 '[prošle] [nedelje] [u] LT', 96 '[prošlog] [ponedeljka] [u] LT', 97 '[prošlog] [utorka] [u] LT', 98 '[prošle] [srede] [u] LT', 99 '[prošlog] [četvrtka] [u] LT', 100 '[prošlog] [petka] [u] LT', 101 '[prošle] [subote] [u] LT', 102 ]; 103 return lastWeekDays[this.day()]; 104 }, 105 sameElse: 'L', 106 }, 107 relativeTime: { 108 future: 'za %s', 109 past: 'pre %s', 110 s: 'nekoliko sekundi', 111 ss: translator.translate, 112 m: translator.translate, 113 mm: translator.translate, 114 h: translator.translate, 115 hh: translator.translate, 116 d: translator.translate, 117 dd: translator.translate, 118 M: translator.translate, 119 MM: translator.translate, 120 y: translator.translate, 121 yy: translator.translate, 122 }, 123 dayOfMonthOrdinalParse: /\d{1,2}\./, 124 ordinal: '%d.', 125 week: { 126 dow: 1, // Monday is the first day of the week. 127 doy: 7, // The week that contains Jan 7th is the first week of the year. 128 }, 129});