UNPKG

3.88 kBJavaScriptView Raw
1// Slovenian [sl]
2import dayjs from '../index';
3
4function dual(n) {
5 return n % 100 == 2; // eslint-disable-line
6}
7
8function threeFour(n) {
9 return n % 100 == 3 || n % 100 == 4; // eslint-disable-line
10}
11/* eslint-disable */
12
13
14function translate(number, withoutSuffix, key, isFuture) {
15 var result = number + " ";
16
17 switch (key) {
18 case 's':
19 // a few seconds / in a few seconds / a few seconds ago
20 return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
21
22 case 'm':
23 // a minute / in a minute / a minute ago
24 return withoutSuffix ? 'ena minuta' : 'eno minuto';
25
26 case 'mm':
27 // 9 minutes / in 9 minutes / 9 minutes ago
28 if (dual(number)) {
29 return result + (withoutSuffix || isFuture ? 'minuti' : 'minutama');
30 }
31
32 if (threeFour(number)) {
33 return result + (withoutSuffix || isFuture ? 'minute' : 'minutami');
34 }
35
36 return result + (withoutSuffix || isFuture ? 'minut' : 'minutami');
37
38 case 'h':
39 // an hour / in an hour / an hour ago
40 return withoutSuffix ? 'ena ura' : isFuture ? 'eno uro' : 'eno uro';
41
42 case 'hh':
43 // 9 hours / in 9 hours / 9 hours ago
44 if (dual(number)) {
45 return result + (withoutSuffix || isFuture ? 'uri' : 'urama');
46 }
47
48 if (threeFour(number)) {
49 return result + (withoutSuffix || isFuture ? 'ure' : 'urami');
50 }
51
52 return result + (withoutSuffix || isFuture ? 'ur' : 'urami');
53
54 case 'd':
55 // a day / in a day / a day ago
56 return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
57
58 case 'dd':
59 // 9 days / in 9 days / 9 days ago
60 if (dual(number)) {
61 return result + (withoutSuffix || isFuture ? 'dneva' : 'dnevoma');
62 }
63
64 return result + (withoutSuffix || isFuture ? 'dni' : 'dnevi');
65
66 case 'M':
67 // a month / in a month / a month ago
68 return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
69
70 case 'MM':
71 // 9 months / in 9 months / 9 months ago
72 if (dual(number)) {
73 // 2 minutes / in 2 minutes
74 return result + (withoutSuffix || isFuture ? 'meseca' : 'mesecema');
75 }
76
77 if (threeFour(number)) {
78 return result + (withoutSuffix || isFuture ? 'mesece' : 'meseci');
79 }
80
81 return result + (withoutSuffix || isFuture ? 'mesecev' : 'meseci');
82
83 case 'y':
84 // a year / in a year / a year ago
85 return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
86
87 case 'yy':
88 // 9 years / in 9 years / 9 years ago
89 if (dual(number)) {
90 // 2 minutes / in 2 minutes
91 return result + (withoutSuffix || isFuture ? 'leti' : 'letoma');
92 }
93
94 if (threeFour(number)) {
95 return result + (withoutSuffix || isFuture ? 'leta' : 'leti');
96 }
97
98 return result + (withoutSuffix || isFuture ? 'let' : 'leti');
99 }
100}
101/* eslint-enable */
102
103
104var locale = {
105 name: 'sl',
106 weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
107 months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
108 weekStart: 1,
109 weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
110 monthsShort: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
111 weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'),
112 ordinal: function ordinal(n) {
113 return n + ".";
114 },
115 formats: {
116 LT: 'H:mm',
117 LTS: 'H:mm:ss',
118 L: 'DD.MM.YYYY',
119 LL: 'D. MMMM YYYY',
120 LLL: 'D. MMMM YYYY H:mm',
121 LLLL: 'dddd, D. MMMM YYYY H:mm',
122 l: 'D. M. YYYY'
123 },
124 relativeTime: {
125 future: 'čez %s',
126 past: 'pred %s',
127 s: 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};
140dayjs.locale(locale, null, true);
141export default locale;
\No newline at end of file