Make it work: ICU/php-intl mnemonic tag "few" for pluralization formatting -
icu message formatting doesn't seem work me. here's example:
$n = 22; $f = messageformatter::create('ru', '{n, plural, one{корова} few{коровы} many{коров} other{коров}}'); echo $n.' '.$f->format(['n' => $n])."\n"; i 22 коров in output, should 22 коровы. tried on several ubuntu servers.
language: russian
php-intl version 1.1.0
icu version 52.1
any appriciated, cause stuck on it.
that's 1 nasty bug, 1 i've spent hour figuring out. well, turns out in icu 52.1 (probably before, too) have following:
set34{ many{ "v = 0 , % 10 = 0 or v = 0 , % 10 = 5..9 or v = 0 , % 100" " = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …" } one{ "v = 0 , % 10 = 1 , % 100 != 11 @integer 1, 21, 31, 41, 51, 6" "1, 71, 81, 101, 1001, …" } other{ " @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal" " 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …" } } source: http://source.icu-project.org/repos/icu/icu/tags/release-52-1/source/data/misc/plurals.txt
so, cases of 2-4, 22-24 , on (22 коровы) fall under other modifier, correct syntax case {n, plural, one{корова} few{коровы} many{коров} other{коровы}}. left few in compatibility newer icu versions (which indeed use few modifier case).
Comments
Post a Comment