如何在Yii2中设置语言属性

时间:2016-03-29 11:49:37

标签: php yii2

我想将语言设置为这样的属性:

public function rules() {
    return [
        ['name', 'language' => 'ru', 'message' => 'Just enter the Russian.]
    ]
}

1 个答案:

答案 0 :(得分:2)

试试这个:

public function rules() {
    return [
       ['name', 'match', 'pattern' => '/[а-ѩA-Ѩ]+$/u', 'message' =>Yii::t('app', 'Just enter Russian') ]
    ]
}