diff --git a/src/I18n/PluralRules.php b/src/I18n/PluralRules.php index 606194064c9..f1a53478700 100644 --- a/src/I18n/PluralRules.php +++ b/src/I18n/PluralRules.php @@ -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: diff --git a/tests/TestCase/I18n/PluralRulesTest.php b/tests/TestCase/I18n/PluralRulesTest.php index 56f4eeb3f86..e5d99bcb26e 100644 --- a/tests/TestCase/I18n/PluralRulesTest.php +++ b/tests/TestCase/I18n/PluralRulesTest.php @@ -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] ]; }