1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var formatDistanceLocale = {
lessThanXSeconds: {
regular: {
one: '1 секундтан аз',
singularNominative: '{{count}} секундтан аз',
singularGenitive: '{{count}} секундтан аз',
pluralGenitive: '{{count}} секундтан аз'
},
future: {
one: 'бір секундтан кейін',
singularNominative: '{{count}} секундтан кейін',
singularGenitive: '{{count}} секундтан кейін',
pluralGenitive: '{{count}} секундтан кейін'
}
},
xSeconds: {
regular: {
singularNominative: '{{count}} секунд',
singularGenitive: '{{count}} секунд',
pluralGenitive: '{{count}} секунд'
},
past: {
singularNominative: '{{count}} секунд бұрын',
singularGenitive: '{{count}} секунд бұрын',
pluralGenitive: '{{count}} секунд бұрын'
},
future: {
singularNominative: '{{count}} секундтан кейін',
singularGenitive: '{{count}} секундтан кейін',
pluralGenitive: '{{count}} секундтан кейін'
}
},
halfAMinute: function halfAMinute(options) {
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return 'жарты минут ішінде';
} else {
return 'жарты минут бұрын';
}
}
return 'жарты минут';
},
lessThanXMinutes: {
regular: {
one: '1 минуттан аз',
singularNominative: '{{count}} минуттан аз',
singularGenitive: '{{count}} минуттан аз',
pluralGenitive: '{{count}} минуттан аз'
},
future: {
one: 'минуттан кем ',
singularNominative: '{{count}} минуттан кем',
singularGenitive: '{{count}} минуттан кем',
pluralGenitive: '{{count}} минуттан кем'
}
},
xMinutes: {
regular: {
singularNominative: '{{count}} минут',
singularGenitive: '{{count}} минут',
pluralGenitive: '{{count}} минут'
},
past: {
singularNominative: '{{count}} минут бұрын',
singularGenitive: '{{count}} минут бұрын',
pluralGenitive: '{{count}} минут бұрын'
},
future: {
singularNominative: '{{count}} минуттан кейін',
singularGenitive: '{{count}} минуттан кейін',
pluralGenitive: '{{count}} минуттан кейін'
}
},
aboutXHours: {
regular: {
singularNominative: 'шамамен {{count}} сағат',
singularGenitive: 'шамамен {{count}} сағат',
pluralGenitive: 'шамамен {{count}} сағат'
},
future: {
singularNominative: 'шамамен {{count}} сағаттан кейін',
singularGenitive: 'шамамен {{count}} сағаттан кейін',
pluralGenitive: 'шамамен {{count}} сағаттан кейін'
}
},
xHours: {
regular: {
singularNominative: '{{count}} сағат',
singularGenitive: '{{count}} сағат',
pluralGenitive: '{{count}} сағат'
}
},
xDays: {
regular: {
singularNominative: '{{count}} күн',
singularGenitive: '{{count}} күн',
pluralGenitive: '{{count}} күн'
},
future: {
singularNominative: '{{count}} күннен кейін',
singularGenitive: '{{count}} күннен кейін',
pluralGenitive: '{{count}} күннен кейін'
}
},
aboutXWeeks: {
type: 'weeks',
one: 'шамамен 1 апта',
other: 'шамамен {{count}} апта'
},
xWeeks: {
type: 'weeks',
one: '1 апта',
other: '{{count}} апта'
},
aboutXMonths: {
regular: {
singularNominative: 'шамамен {{count}} ай',
singularGenitive: 'шамамен {{count}} ай',
pluralGenitive: 'шамамен {{count}} ай'
},
future: {
singularNominative: 'шамамен {{count}} айдан кейін',
singularGenitive: 'шамамен {{count}} айдан кейін',
pluralGenitive: 'шамамен {{count}} айдан кейін'
}
},
xMonths: {
regular: {
singularNominative: '{{count}} ай',
singularGenitive: '{{count}} ай',
pluralGenitive: '{{count}} ай'
}
},
aboutXYears: {
regular: {
singularNominative: 'шамамен {{count}} жыл',
singularGenitive: 'шамамен {{count}} жыл',
pluralGenitive: 'шамамен {{count}} жыл'
},
future: {
singularNominative: 'шамамен {{count}} жылдан кейін',
singularGenitive: 'шамамен {{count}} жылдан кейін',
pluralGenitive: 'шамамен {{count}} жылдан кейін'
}
},
xYears: {
regular: {
singularNominative: '{{count}} жыл',
singularGenitive: '{{count}} жыл',
pluralGenitive: '{{count}} жыл'
},
future: {
singularNominative: '{{count}} жылдан кейін',
singularGenitive: '{{count}} жылдан кейін',
pluralGenitive: '{{count}} жылдан кейін'
}
},
overXYears: {
regular: {
singularNominative: '{{count}} жылдан астам',
singularGenitive: '{{count}} жылдан астам',
pluralGenitive: '{{count}} жылдан астам'
},
future: {
singularNominative: '{{count}} жылдан астам',
singularGenitive: '{{count}} жылдан астам',
pluralGenitive: '{{count}} жылдан астам'
}
},
almostXYears: {
regular: {
singularNominative: '{{count}} жылға жақын',
singularGenitive: '{{count}} жылға жақын',
pluralGenitive: '{{count}} жылға жақын'
},
future: {
singularNominative: '{{count}} жылдан кейін',
singularGenitive: '{{count}} жылдан кейін',
pluralGenitive: '{{count}} жылдан кейін'
}
}
};
function declension(scheme, count) {
// scheme for count=1 exists
if (scheme.one && count === 1) return scheme.one;
var rem10 = count % 10;
var rem100 = count % 100;
// 1, 21, 31, ...
if (rem10 === 1 && rem100 !== 11) {
return scheme.singularNominative.replace('{{count}}', String(count));
// 2, 3, 4, 22, 23, 24, 32 ...
} else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) {
return scheme.singularGenitive.replace('{{count}}', String(count));
// 5, 6, 7, 8, 9, 10, 11, ...
} else {
return scheme.pluralGenitive.replace('{{count}}', String(count));
}
}
var formatDistance = function formatDistance(token, count, options) {
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === 'function') return tokenValue(options);
if (tokenValue.type === 'weeks') {
return count === 1 ? tokenValue.one : tokenValue.other.replace('{{count}}', String(count));
}
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
if (tokenValue.future) {
return declension(tokenValue.future, count);
} else {
return declension(tokenValue.regular, count) + ' кейін';
}
} else {
if (tokenValue.past) {
return declension(tokenValue.past, count);
} else {
return declension(tokenValue.regular, count) + ' бұрын';
}
}
} else {
return declension(tokenValue.regular, count);
}
};
var _default = formatDistance;
exports.default = _default;
module.exports = exports.default;
|