yiisoft/yii2 — pull request #5038 by stepanselyuk (2014-09-15 19:52:54+00:00)
Title: Option to give parameter values for Yii::t as a Closure.

```php
public function rules() {
return [
[
'item_name',
'unique',
'targetAttribute' => [ 'item_name' ],
'filter' => function ( $query ) {

/** @var \yii\db\Query $query */
// Check for complex Primary Key [item_name, user_id]
$query->andWhere( [ 'user_id' => $this->user_id ] );
},
'message' => Yii::t('application',
'Specified auth item "{value}" already assigned for user "{login}".',
[
'login' => function () { return $this->user->login; },
'name' => $this->item_name
]
)
]
];
}