szfjozsef
(Szfjozsef)
November 1, 2016, 10:54am
1
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?
Bizley
(Bizley)
November 1, 2016, 11:18am
2
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.
szfjozsef
(Szfjozsef)
November 9, 2016, 8:38pm
3
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.
Bizley
(Bizley)
November 10, 2016, 6:16pm
4
ICU 4.2.1 is 7 years old. It’s time to consider changing your server provider.