forked from andresaraujo/timeago.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathru_messages.dart
124 lines (120 loc) · 3.17 KB
/
ru_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';
/// Russian messages
class RuMessages 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 RuShortMessages 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() => ' ';
}