I built a Chinese language package in frontend>messages, why can’t it be used in the form model in frontend>model? 'id'=> Yii::t('common','ID'), says Yii is an undefined class? Please God, what is going on?
This is the code for the language pack:
return [
'Blog'=>'博客',
'Article'=>'文章',
'Signup'=>'注册',
'Login'=>'登录',
'Email' => '邮箱',
'artTitle'=> '文章标题',
];
This is the calling code:
public function attributeLabels()
{
return [
//'id'=> Yii::t('common','ID'),
//'id' => '编码',
//'title' => '标题',
'title' => yii::t('common','artTitle'),
'content' => '内容',
'label_img' =>'标签图',
'tags' => '标签',
'cat_id'=>'分类'
];
}
yii said it is an undefined class~
Please give me some guidance on how to modify it
滿天的星座2017-06-06 09:55:46
If you do not use Yii, you need Yii:t() to indicate that you are searching in the root namespace.