0

I have used https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#parameter-formatting

but on my server, it displayed like a full string without any effect of intl.

my code is like:

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

expected result:

// When $n = 0, it may produce "There are no cats!"
// When $n = 1, it may produce "There is one cat!"
// When $n = 42, it may produce "There are 42 cats!"

but it displays the whole expression here without any effect

here is the php info enter image description here

Er.KT
  • 2,852
  • 1
  • 36
  • 70
  • 1
    I think your ICU version is low. See what documenation says: https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#setup-environment `It is also recommended that you use an ICU version equal or greater than version 49` – vvpanchev Feb 15 '21 at 07:18
  • @vvpanchev PHP: 7.3.27 ICU: 4.2.1 Warning: Use of undefined constant INTL_ICU_DATA_VERSION - assumed 'INTL_ICU_DATA_VERSION' (this will throw an Error in a future version of PHP) – Er.KT Feb 15 '21 at 08:27
  • @vvpanchev fixed by upgrading ICU version on the server, thanks a lot buddy – Er.KT Feb 16 '21 at 06:34

0 Answers0