Reputation: 2668
We are developing a multi-lingual application with Yii and are setting the language of the website with the Yii::app()->language setting. The problem is that when we switch the language in this way, all of Yii's built-in error messages also change to display in that language. This makes debugging a bit irritating as I have to set the language to English and then reload the page to read the error.
I've tried using Yii::app()->souceLanguage = 'en_US', but this doesn't seem to make any difference to the error messages. Any idea how to set up Yii to display the site's content in one language (using Yii::t()) and the error messages in another?
Upvotes: 1
Views: 874
Reputation: 7387
You can override CPhpMessageSource::loadMessages() with something like following:
protected function loadMessages($category, $language)
{
if ($category === 'yii') {
return array();
} else {
return parent::loadMessages($category, $language);
}
}
Upvotes: 2