forked from andresaraujo/timeago.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbe_messages.dart
124 lines (120 loc) · 3.28 KB
/
be_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';
/// Belarusian messages (code based by russian and ukrainian translations)
class BeMessages 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 BeShortMessages 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() => ' ';
}