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