Plural translation not working

Hi!

After struggling with not working plural translations, I took the example from the guide, inserted in my code as


$info = Yii::t('system', 'There {n,plural,=0{are no cats} =1{is one cat} other{are # cats}}!', ['n'=>1]);

and it displays

There {n} {n,plural,=0{are no cats} one{is one cat} other{are # cats}}!

If I change the string to be translated to


There {n,plural,one{is one cat} other{are # cats}}!

then it works. Based on tryings, the =0 or =1 expressions doesn’t work, the function returns the expression itself, without translation.

What can be the problem?

First of all - is the intl installed on your system? To check run requirements.php from the main folder and look for the ‘Intl extension’ key.

Intl is installed, but ICU has the version 4.2.1.

The documentation says, it is best to have 4.8+ which is quite strange, since 90% of the websites are on shared servers, where there is no way to install anything.

ICU 4.2.1 is 7 years old. It’s time to consider changing your server provider.