1 |
|
2 | import dayjs from '../index';
|
3 |
|
4 | function plural(n) {
|
5 | return n > 1 && n < 5 && ~~(n / 10) !== 1;
|
6 | }
|
7 |
|
8 |
|
9 |
|
10 | function translate(number, withoutSuffix, key, isFuture) {
|
11 | var result = number + " ";
|
12 |
|
13 | switch (key) {
|
14 | case 's':
|
15 |
|
16 | return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
|
17 |
|
18 | case 'm':
|
19 |
|
20 | return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
|
21 |
|
22 | case 'mm':
|
23 |
|
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 |
|
32 | return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
|
33 |
|
34 | case 'hh':
|
35 |
|
36 | if (withoutSuffix || isFuture) {
|
37 | return result + (plural(number) ? 'hodiny' : 'hodín');
|
38 | }
|
39 |
|
40 | return result + "hodinami";
|
41 |
|
42 | case 'd':
|
43 |
|
44 | return withoutSuffix || isFuture ? 'deň' : 'dňom';
|
45 |
|
46 | case 'dd':
|
47 |
|
48 | if (withoutSuffix || isFuture) {
|
49 | return result + (plural(number) ? 'dni' : 'dní');
|
50 | }
|
51 |
|
52 | return result + "d\u0148ami";
|
53 |
|
54 | case 'M':
|
55 |
|
56 | return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
|
57 |
|
58 | case 'MM':
|
59 |
|
60 | if (withoutSuffix || isFuture) {
|
61 | return result + (plural(number) ? 'mesiace' : 'mesiacov');
|
62 | }
|
63 |
|
64 | return result + "mesiacmi";
|
65 |
|
66 | case 'y':
|
67 |
|
68 | return withoutSuffix || isFuture ? 'rok' : 'rokom';
|
69 |
|
70 | case 'yy':
|
71 |
|
72 | if (withoutSuffix || isFuture) {
|
73 | return result + (plural(number) ? 'roky' : 'rokov');
|
74 | }
|
75 |
|
76 | return result + "rokmi";
|
77 | }
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 | var 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 |
|
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 | };
|
120 | dayjs.locale(locale, null, true);
|
121 | export default locale; |
\ | No newline at end of file |