I am programming on an app with intense usage of Yii:t() with symbols. i created a fictional sourceLanguage and use mostly symbols for messages and such.
during that i stumbled upon a very strange behavior of some validators.
UniqueValdator
if($exists)
{
$message=$this->message!==null?$this->message:Yii::t('yii','{attribute} "{value}" has
already been taken.');
$this->addError($object,$attribute,$message,array('{value}'=>$value));
}
means that {value} is translated into $value after assignment which means that you can use {value} inside your own ‘message’=> assignments withing validator rules
within RequiredValidator
$message=$this->message!==null?$this->message:Yii::t('yii','{attribute} must be {value}.',
array('{value}'=>$this->requiredValue));
$this->addError($object,$attribute,$message);
within BooleanValidator
$message=$this->message!==null?$this->message:Yii::t('yii','{attribute} must be either {true} or {false}.',
array('{true}'=>$this->trueValue, '{false}'=>$this->falseValue));
$this->addError($object,$attribute,$message);
means in this both validators you cant use {value}, {true} or {false} in your own ‘message’`=> assignments.
in my opinion it would make sense to use the same approach in every validator
$this->addError($object,$attribute,$message,array('{value}'=>$value));
^^ get all variables that might be
useful within messages in here instead of the Yii::t() call
but i might as so often be wrong
thanks in advance for any response