forked from andresaraujo/timeago.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuk_messages.dart
124 lines (120 loc) · 3.11 KB
/
uk_messages.dart
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
import 'package:timeago/src/messages/lookupmessages.dart';
/// Ukrainian messages
class UkMessages implements LookupMessages {
@override
String prefixAgo() => '';
@override
String prefixFromNow() => 'через';
@override
String suffixAgo() => 'тому';
@override
String suffixFromNow() => '';
@override
String lessThanOneMinute(int seconds) => 'хвилину';
@override
String aboutAMinute(int minutes) => 'хвилину';
@override
String minutes(int minutes) => '$minutes ${_convert(minutes, 'minutes')}';
@override
String aboutAnHour(int minutes) => 'годину';
@override
String hours(int hours) => '$hours ${_convert(hours, 'hours')}';
@override
String aDay(int hours) => 'день';
@override
String days(int days) => '$days ${_convert(days, 'days')}';
@override
String aboutAMonth(int days) => 'місяць';
@override
String months(int months) => '$months ${_convert(months, 'months')}';
@override
String aboutAYear(int year) => 'рік';
@override
String years(int years) => '$years ${_convert(years, 'years')}';
@override
String wordSeparator() => ' ';
}
String _convert(int number, String type) {
var mod = number % 10;
var modH = number % 100;
if (mod == 1 && modH != 11) {
switch (type) {
case 'minutes':
return 'хвилину';
case 'hours':
return 'годину';
case 'days':
return 'день';
case 'months':
return 'місяць';
case 'years':
return 'рік';
default:
return '';
}
} else if (<int>[2, 3, 4].contains(mod) &&
!<int>[12, 13, 14].contains(modH)) {
switch (type) {
case 'minutes':
return 'хвилини';
case 'hours':
return 'години';
case 'days':
return 'дні';
case 'months':
return 'місяця';
case 'years':
return 'роки';
default:
return '';
}
}
switch (type) {
case 'minutes':
return 'хвилин';
case 'hours':
return 'годин';
case 'days':
return 'днів';
case 'months':
return 'місяців';
case 'years':
return 'років';
default:
return '';
}
}
class UkShortMessages implements LookupMessages {
@override
String prefixAgo() => '';
@override
String prefixFromNow() => '';
@override
String suffixAgo() => '';
@override
String suffixFromNow() => '';
@override
String lessThanOneMinute(int seconds) => 'тільки що';
@override
String aboutAMinute(int minutes) => '~1 хв.';
@override
String minutes(int minutes) => '$minutes хв.';
@override
String aboutAnHour(int minutes) => '~1 год.';
@override
String hours(int hours) => '$hours год.';
@override
String aDay(int hours) => '~1 д.';
@override
String days(int days) => '$days д.';
@override
String aboutAMonth(int days) => '~1 міс.';
@override
String months(int months) => '$months міс.';
@override
String aboutAYear(int year) => '~1 р.';
@override
String years(int years) => '$years р.';
@override
String wordSeparator() => ' ';
}