phpdevmd
(Phpdevmd)
1
Hello, I have
class _CController extends CController
{
public function init()
{
parent::init();
Yii::app()->language='ru';
}
}
and all controllers extend _CController
is it possible in config/params.php to do something like
'headerTitle'=>Yii::t('w3','Blog Title')
and using Yii::app()->params[‘headerTitle’] get a translated ‘Blog Title’?
Or I necessary have to add
Yii::app()->params['headerTitle']=Yii::t('w3','Blog Title');
after
Yii::app()->language='ru';
Thanks in advance.
qiang
(Qiang Xue)
2
Do not translate in app config because it is too early to do so (at that stage, app components including the translations are being initialized).
Since you already have a base controller class, setting the default page title in its init() method would be the easiest way to go.
phpdevmd
(Phpdevmd)
3
ok, thanks! added
MParams::i18n();
after
Yii::app()->language='ru';