首页 > 解决方案 > php intl参数格式化不适用于yii2

问题描述

我用过https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#parameter-formatting

但在我的服务器上,它显示为一个完整的字符串,没有任何国际影响。

我的代码是这样的:

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

预期结果:

// 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!"

但它在这里显示整个表达式而没有任何效果

这是php信息 在此处输入图像描述

标签: phpyii2centoscentos7intl

解决方案


推荐阅读