Skip to content

Commit dfda591

Browse files
committed
feat: Add Arabic timeago localization
- Implemented ArTimeagoMessages class - Added custom Arabic translations - Supports pluralization rules
1 parent 5d6767f commit dfda591

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import 'package:timeago/timeago.dart' as timeago;
2+
3+
/// Custom Arabic lookup messages for the timeago package.
4+
class ArTimeagoMessages implements timeago.LookupMessages {
5+
@override
6+
String prefixAgo() => 'منذ';
7+
@override
8+
String prefixFromNow() => 'بعد';
9+
@override
10+
String suffixAgo() => '';
11+
@override
12+
String suffixFromNow() => '';
13+
14+
@override
15+
String lessThanOneMinute(int seconds) => 'لحظات';
16+
@override
17+
String aboutAMinute(int minutes) => 'دقيقة واحدة';
18+
@override
19+
String minutes(int minutes) {
20+
if (minutes == 1) return 'دقيقة واحدة';
21+
if (minutes == 2) return 'دقيقتين';
22+
if (minutes >= 3 && minutes <= 10) return '$minutes دقائق';
23+
return '$minutes دقيقة';
24+
}
25+
26+
@override
27+
String aboutAnHour(int minutes) => 'ساعة واحدة';
28+
@override
29+
String hours(int hours) {
30+
if (hours == 1) return 'ساعة واحدة';
31+
if (hours == 2) return 'ساعتين';
32+
if (hours >= 3 && hours <= 10) return '$hours ساعات';
33+
return '$hours ساعة';
34+
}
35+
36+
@override
37+
String aDay(int hours) => 'يوم واحد';
38+
@override
39+
String days(int days) {
40+
if (days == 1) return 'يوم واحد';
41+
if (days == 2) return 'يومين';
42+
if (days >= 3 && days <= 10) return '$days أيام';
43+
return '$days يومًا';
44+
}
45+
46+
@override
47+
String aboutAMonth(int days) => 'شهر واحد';
48+
@override
49+
String months(int months) {
50+
if (months == 1) return 'شهر واحد';
51+
if (months == 2) return 'شهرين';
52+
if (months >= 3 && months <= 10) return '$months أشهر';
53+
return '$months شهرًا';
54+
}
55+
56+
@override
57+
String aboutAYear(int year) => 'سنة واحدة';
58+
@override
59+
String years(int years) {
60+
if (years == 1) return 'سنة واحدة';
61+
if (years == 2) return 'سنتين';
62+
if (years >= 3 && years <= 10) return '$years سنوات';
63+
return '$years سنة';
64+
}
65+
66+
@override
67+
String wordSeparator() => ' ';
68+
}

0 commit comments

Comments
 (0)