Skip to content

Commit 3d58388

Browse files
committed
Fixing maltese plural rules
1 parent e7b0dd1 commit 3d58388

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/I18n/PluralRules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ public static function calculate($locale, $n) {
170170
return $n % 10 == 1 ? 0 : ($n % 10 == 2 ? 1 : 2);
171171
case 9:
172172
return $n == 1 ? 0 :
173-
$n == 0 || ($n % 100 > 0 && $n % 100 <= 10) ? 1 :
174-
$n % 100 > 10 && $n % 100 < 20 ? 2 : 3;
173+
($n == 0 || ($n % 100 > 0 && $n % 100 <= 10) ? 1 :
174+
($n % 100 > 10 && $n % 100 < 20 ? 2 : 3));
175175
case 10:
176176
return $n %10 == 1 && $n % 100 != 11 ? 1 : $n == 0 ? 0 : 2;
177177
case 11:

tests/TestCase/I18n/PluralRulesTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ public function localesProvider() {
7070
['mk', 0, 2],
7171
['mk', 1, 0],
7272
['mk', 13, 2],
73-
['mk', 21, 0]
73+
['mt', 0, 1],
74+
['mt', 1, 0],
75+
['mt', 11, 2],
76+
['mt', 13, 2],
77+
['mt', 21, 3],
78+
['mt', 102, 1]
7479
];
7580
}
7681

0 commit comments

Comments
 (0)