[SOLVED] Multi Language in attributeLabels()

is it possible that:

Yii::t('example', 'example')

doesn't work in the attributeLabels() function?

whole example-code:



public function attributeLabels()


	{


		return array(


			'example'=>Yii::t('example', 'example'),


		);


	}


thank you for an answer

phil

This should work. First make sure Yii::t('example', 'example') works by itself.

everything works fine else, just in the attributeLabels() function it doesn't work.

Do I've to set the language in each Controller?

Now I've just set the language in the site controller like this:

Yii::app()->setLanguage('en');

the problem is that in the other controllers the multilanguage support doesnt work.

shouldn't it remember the language in the other controllers?

Yes, you need to. Yii doesn't provide a persistent storage for the language property. You can use cookie or GET parameter to retrieve language in the init() method of your base controller.

nice, thank you again qiang

made a BaseController in which it override the init-method in which it define the language :)

each Controller extends now from the BaseController.

Hope this is the best way

phil