UNPKG

3.17 kBJavaScriptView Raw
1// Slovak [sk]
2import dayjs from '../index';
3
4function plural(n) {
5 return n > 1 && n < 5 && ~~(n / 10) !== 1; // eslint-disable-line
6}
7/* eslint-disable */
8
9
10function translate(number, withoutSuffix, key, isFuture) {
11 var result = number + " ";
12
13 switch (key) {
14 case 's':
15 // a few seconds / in a few seconds / a few seconds ago
16 return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
17
18 case 'm':
19 // a minute / in a minute / a minute ago
20 return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
21
22 case 'mm':
23 // 9 minutes / in 9 minutes / 9 minutes ago
24 if (withoutSuffix || isFuture) {
25 return result + (plural(number) ? 'minúty' : 'minút');
26 }
27
28 return result + "min\xFAtami";
29
30 case 'h':
31 // an hour / in an hour / an hour ago
32 return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
33
34 case 'hh':
35 // 9 hours / in 9 hours / 9 hours ago
36 if (withoutSuffix || isFuture) {
37 return result + (plural(number) ? 'hodiny' : 'hodín');
38 }
39
40 return result + "hodinami";
41
42 case 'd':
43 // a day / in a day / a day ago
44 return withoutSuffix || isFuture ? 'deň' : 'dňom';
45
46 case 'dd':
47 // 9 days / in 9 days / 9 days ago
48 if (withoutSuffix || isFuture) {
49 return result + (plural(number) ? 'dni' : 'dní');
50 }
51
52 return result + "d\u0148ami";
53
54 case 'M':
55 // a month / in a month / a month ago
56 return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
57
58 case 'MM':
59 // 9 months / in 9 months / 9 months ago
60 if (withoutSuffix || isFuture) {
61 return result + (plural(number) ? 'mesiace' : 'mesiacov');
62 }
63
64 return result + "mesiacmi";
65
66 case 'y':
67 // a year / in a year / a year ago
68 return withoutSuffix || isFuture ? 'rok' : 'rokom';
69
70 case 'yy':
71 // 9 years / in 9 years / 9 years ago
72 if (withoutSuffix || isFuture) {
73 return result + (plural(number) ? 'roky' : 'rokov');
74 }
75
76 return result + "rokmi";
77 }
78}
79/* eslint-enable */
80
81
82var locale = {
83 name: 'sk',
84 weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
85 weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
86 weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
87 months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
88 monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'),
89 weekStart: 1,
90 yearStart: 4,
91 ordinal: function ordinal(n) {
92 return n + ".";
93 },
94 formats: {
95 LT: 'H:mm',
96 LTS: 'H:mm:ss',
97 L: 'DD.MM.YYYY',
98 LL: 'D. MMMM YYYY',
99 LLL: 'D. MMMM YYYY H:mm',
100 LLLL: 'dddd D. MMMM YYYY H:mm',
101 l: 'D. M. YYYY'
102 },
103 relativeTime: {
104 future: 'za %s',
105 // Should be `o %s` (change when moment/moment#5408 is fixed)
106 past: 'pred %s',
107 s: translate,
108 m: translate,
109 mm: translate,
110 h: translate,
111 hh: translate,
112 d: translate,
113 dd: translate,
114 M: translate,
115 MM: translate,
116 y: translate,
117 yy: translate
118 }
119};
120dayjs.locale(locale, null, true);
121export default locale;
\No newline at end of file