sk.js (5173B)
1//! moment.js locale configuration 2//! locale : Slovak [sk] 3//! author : Martin Minka : https://github.com/k2s 4//! based on work of petrbela : https://github.com/petrbela 5 6import moment from '../moment'; 7 8var months = 9 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split( 10 '_' 11 ), 12 monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); 13function plural(n) { 14 return n > 1 && n < 5; 15} 16function translate(number, withoutSuffix, key, isFuture) { 17 var result = number + ' '; 18 switch (key) { 19 case 's': // a few seconds / in a few seconds / a few seconds ago 20 return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami'; 21 case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago 22 if (withoutSuffix || isFuture) { 23 return result + (plural(number) ? 'sekundy' : 'sekúnd'); 24 } else { 25 return result + 'sekundami'; 26 } 27 case 'm': // a minute / in a minute / a minute ago 28 return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou'; 29 case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago 30 if (withoutSuffix || isFuture) { 31 return result + (plural(number) ? 'minúty' : 'minút'); 32 } else { 33 return result + 'minútami'; 34 } 35 case 'h': // an hour / in an hour / an hour ago 36 return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou'; 37 case 'hh': // 9 hours / in 9 hours / 9 hours ago 38 if (withoutSuffix || isFuture) { 39 return result + (plural(number) ? 'hodiny' : 'hodín'); 40 } else { 41 return result + 'hodinami'; 42 } 43 case 'd': // a day / in a day / a day ago 44 return withoutSuffix || isFuture ? 'deň' : 'dňom'; 45 case 'dd': // 9 days / in 9 days / 9 days ago 46 if (withoutSuffix || isFuture) { 47 return result + (plural(number) ? 'dni' : 'dní'); 48 } else { 49 return result + 'dňami'; 50 } 51 case 'M': // a month / in a month / a month ago 52 return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom'; 53 case 'MM': // 9 months / in 9 months / 9 months ago 54 if (withoutSuffix || isFuture) { 55 return result + (plural(number) ? 'mesiace' : 'mesiacov'); 56 } else { 57 return result + 'mesiacmi'; 58 } 59 case 'y': // a year / in a year / a year ago 60 return withoutSuffix || isFuture ? 'rok' : 'rokom'; 61 case 'yy': // 9 years / in 9 years / 9 years ago 62 if (withoutSuffix || isFuture) { 63 return result + (plural(number) ? 'roky' : 'rokov'); 64 } else { 65 return result + 'rokmi'; 66 } 67 } 68} 69 70export default moment.defineLocale('sk', { 71 months: months, 72 monthsShort: monthsShort, 73 weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), 74 weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'), 75 weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'), 76 longDateFormat: { 77 LT: 'H:mm', 78 LTS: 'H:mm:ss', 79 L: 'DD.MM.YYYY', 80 LL: 'D. MMMM YYYY', 81 LLL: 'D. MMMM YYYY H:mm', 82 LLLL: 'dddd D. MMMM YYYY H:mm', 83 }, 84 calendar: { 85 sameDay: '[dnes o] LT', 86 nextDay: '[zajtra o] LT', 87 nextWeek: function () { 88 switch (this.day()) { 89 case 0: 90 return '[v nedeľu o] LT'; 91 case 1: 92 case 2: 93 return '[v] dddd [o] LT'; 94 case 3: 95 return '[v stredu o] LT'; 96 case 4: 97 return '[vo štvrtok o] LT'; 98 case 5: 99 return '[v piatok o] LT'; 100 case 6: 101 return '[v sobotu o] LT'; 102 } 103 }, 104 lastDay: '[včera o] LT', 105 lastWeek: function () { 106 switch (this.day()) { 107 case 0: 108 return '[minulú nedeľu o] LT'; 109 case 1: 110 case 2: 111 return '[minulý] dddd [o] LT'; 112 case 3: 113 return '[minulú stredu o] LT'; 114 case 4: 115 case 5: 116 return '[minulý] dddd [o] LT'; 117 case 6: 118 return '[minulú sobotu o] LT'; 119 } 120 }, 121 sameElse: 'L', 122 }, 123 relativeTime: { 124 future: 'za %s', 125 past: 'pred %s', 126 s: translate, 127 ss: translate, 128 m: translate, 129 mm: translate, 130 h: translate, 131 hh: translate, 132 d: translate, 133 dd: translate, 134 M: translate, 135 MM: translate, 136 y: translate, 137 yy: translate, 138 }, 139 dayOfMonthOrdinalParse: /\d{1,2}\./, 140 ordinal: '%d.', 141 week: { 142 dow: 1, // Monday is the first day of the week. 143 doy: 4, // The week that contains Jan 4th is the first week of the year. 144 }, 145});