Change default yii messages

Hi,

I can’t find any way to change the default Yii messages (‘localID/yii.php’)

I have created a yii.php file in messages/fr/yii.php but looks like since version 1.1.2 this does not overwrite the default messages.

messages/fr/yii.php




<?php


return array (

'Get a new code' => 'Rafraîchir',

'{attribute} cannot be blank.' => 'champ requis',

);



It returns the default value from /vendors/yii/messages/fr/yii.php




  'Get a new code' => 'Récupérez un nouveau code',



bump.

I really need to find out how to do this as I’m working on a project in my company.

bump.

Are you sure, this worked before?

Somehow i feel like i’ve played with this once, too (with success). But i now tried again with 1.1.3 and different 1.0.x versions. None of them used my protected/messages/de/yii.php. Also tested with different settings for language/sourceLanguage.

So, the best way would be to replace the parameter of thelanguage files location and copy Yii.php and change content ?

It should work if you configure the coreMessages component in your main.php to point to another basePath. This is the default configuration in framework/base/CApplication.php:756


    protected function registerCoreComponents()

    {

        $components=array(

            'coreMessages'=>array(

                'class'=>'CPhpMessageSource',

                'language'=>'en_us',

                'basePath'=>YII_PATH.DIRECTORY_SEPARATOR.'messages',

            ),



Something like Yii::getPathOfAlias(‘application.messages’) should do it. Not tested.

And as i said: Not sure if it also should work by overriding the coremessages in protected/messages/de/yii.php. Maybe it should and we can consider this as a bug :)

You can configure it in your main.php:




'coreMessages'=>array(

    'basePath'=>'path/to/your/messages',

),



Also see this one: http://www.yiiframework.com/doc/cookbook/18/