Yii::t() first param strange behavior


This is not really a bug, since this option is not mentioned in the docs, but it is a feature that almost works.

So i tried using Yii::t(‘cat’, ‘msg’, array(‘opt’)) to choose from the translation file that looks like this:

return array(

‘msg’=>‘n==“opt”#some msg|n==“opt2”#some other msg’,


Notice i use a string instead of a number for choosing the return message.

This works fine as long as in the expression string the character "n" does not appear.

When it does, no matches found for the expression given.


Yii::t(‘cat’, ‘msg’, array(‘onOpt’))

return array(

‘msg’=>‘n==“onOpt”#some msg|n==“opt2”#some other msg’,


returned: "some other msg", since no matching string found in the expression.