Revert "fix(locale-core): plural numbers for russian or maybe slavic languages"

This reverts commit c0efd19fcd.
This commit is contained in:
veselcraft 2025-03-16 17:45:07 +03:00
parent 8be6fae0dd
commit bed2c9748b
No known key found for this signature in database
GPG key ID: 9CF0B42766CCF7BA
2 changed files with 10 additions and 12 deletions

View file

@ -121,17 +121,15 @@ function tr(string $stringId, ...$variables): string
if (gettype($variables[0]) === "integer") { if (gettype($variables[0]) === "integer") {
$numberedStringId = null; $numberedStringId = null;
$cardinal = $variables[0]; $cardinal = $variables[0];
// WARNING: Hardcoded for russian language switch ($cardinal) {
if ($cardinal == 0) { case 0:
$numberedStringId = $stringId . "_zero"; $numberedStringId = $stringId . "_zero";
} else if ($cardinal == 1 || $cardinal % 10 == 1) { break;
case 1:
$numberedStringId = $stringId . "_one"; $numberedStringId = $stringId . "_one";
} else if (($cardinal % 10 >= 2 && $cardinal % 10 <= 4) || !($cardinal % 100 >= 12 && $cardinal % 100 <= 14)) { break;
$numberedStringId = $stringId . "_few"; default:
} else if ($cardinal % 10 == 0 || ($cardinal % 10 >= 5 && $cardinal % 10 <= 9) || ($cardinal % 100 >= 11 && $cardinal % 100 <= 14)) { $numberedStringId = $stringId . ($cardinal < 5 ? "_few" : "_other");
$numberedStringId = $stringId . "_many";
} else {
$numberedStringId = $stringId . "_other";
} }
$newOutput = $localizer->_($numberedStringId, $lang); $newOutput = $localizer->_($numberedStringId, $lang);

View file

@ -84,7 +84,7 @@
"desc_none" = "описание отсутствует"; "desc_none" = "описание отсутствует";
"send" = "Отправить"; "send" = "Отправить";
"years_zero" = "0 лет"; "years_zero" = "0 лет";
"years_one" = "$1 год"; "years_one" = "1 год";
"years_few" = "$1 года"; "years_few" = "$1 года";
"years_many" = "$1 лет"; "years_many" = "$1 лет";
"years_other" = "$1 лет"; "years_other" = "$1 лет";