Skip to content

Commit

Permalink
Fixing maltese plural rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jul 21, 2014
1 parent e7b0dd1 commit 3d58388
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/I18n/PluralRules.php
Expand Up @@ -170,8 +170,8 @@ public static function calculate($locale, $n) {
return $n % 10 == 1 ? 0 : ($n % 10 == 2 ? 1 : 2);
case 9:
return $n == 1 ? 0 :
$n == 0 || ($n % 100 > 0 && $n % 100 <= 10) ? 1 :
$n % 100 > 10 && $n % 100 < 20 ? 2 : 3;
($n == 0 || ($n % 100 > 0 && $n % 100 <= 10) ? 1 :
($n % 100 > 10 && $n % 100 < 20 ? 2 : 3));
case 10:
return $n %10 == 1 && $n % 100 != 11 ? 1 : $n == 0 ? 0 : 2;
case 11:
Expand Down
7 changes: 6 additions & 1 deletion tests/TestCase/I18n/PluralRulesTest.php
Expand Up @@ -70,7 +70,12 @@ public function localesProvider() {
['mk', 0, 2],
['mk', 1, 0],
['mk', 13, 2],
['mk', 21, 0]
['mt', 0, 1],
['mt', 1, 0],
['mt', 11, 2],
['mt', 13, 2],
['mt', 21, 3],
['mt', 102, 1]
];
}

Expand Down

0 comments on commit 3d58388

Please sign in to comment.