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 sekund' : 'pár sekundami';
|
17 |
|
18 | case 'm':
|
19 |
|
20 | return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou';
|
21 |
|
22 | case 'mm':
|
23 |
|
24 | if (withoutSuffix || isFuture) {
|
25 | return result + (plural(number) ? 'minuty' : 'minut');
|
26 | }
|
27 |
|
28 | return result + "minutami";
|
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' : 'hodin');
|
38 | }
|
39 |
|
40 | return result + "hodinami";
|
41 |
|
42 | case 'd':
|
43 |
|
44 | return withoutSuffix || isFuture ? 'den' : 'dnem';
|
45 |
|
46 | case 'dd':
|
47 |
|
48 | if (withoutSuffix || isFuture) {
|
49 | return result + (plural(number) ? 'dny' : 'dní');
|
50 | }
|
51 |
|
52 | return result + "dny";
|
53 |
|
54 | case 'M':
|
55 |
|
56 | return withoutSuffix || isFuture ? 'měsíc' : 'měsícem';
|
57 |
|
58 | case 'MM':
|
59 |
|
60 | if (withoutSuffix || isFuture) {
|
61 | return result + (plural(number) ? 'měsíce' : 'měsíců');
|
62 | }
|
63 |
|
64 | return result + "m\u011Bs\xEDci";
|
65 |
|
66 | case 'y':
|
67 |
|
68 | return withoutSuffix || isFuture ? 'rok' : 'rokem';
|
69 |
|
70 | case 'yy':
|
71 |
|
72 | if (withoutSuffix || isFuture) {
|
73 | return result + (plural(number) ? 'roky' : 'let');
|
74 | }
|
75 |
|
76 | return result + "lety";
|
77 | }
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 | var locale = {
|
83 | name: 'cs',
|
84 | weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
|
85 | weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'),
|
86 | weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'),
|
87 | months: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
|
88 | monthsShort: 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.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 | past: 'před %s',
|
106 | s: translate,
|
107 | m: translate,
|
108 | mm: translate,
|
109 | h: translate,
|
110 | hh: translate,
|
111 | d: translate,
|
112 | dd: translate,
|
113 | M: translate,
|
114 | MM: translate,
|
115 | y: translate,
|
116 | yy: translate
|
117 | }
|
118 | };
|
119 | dayjs.locale(locale, null, true);
|
120 | export default locale; |
\ | No newline at end of file |