Problem With Localedatapath Between Cwebapplication And Cconsoleapplication


I’ve an app for which I share config between web and console app. I also have some custom localization formats in protected/i18n/data/.

In my config/main.php I have:

  return array(


      'name'=>'My Web Application',






      'behaviors' => array('ApplicationConfigBehavior'),

then my config/console.php has the following content:

$mainConfigArray = include dirname(__FILE__).DIRECTORY_SEPARATOR.'main.php';

// This is the configuration for yiic console application.

// Any writable CConsoleApplication properties can be configured here.

return array(


    'name'=>'My Web App CLI',





Everything works great in Web, but with this config when I run a console command I get an error “Unknown localization ‘it’”.

If I change localeDataPath to “dirname(FILE).DIRECTORY_SEPARATOR.’…’.DIRECTORY_SEPARATOR.‘i18n/data’” then the localization file is loaded correctly but I get another error saying $GLOBALS[‘yii’] is not defined.

In my locale file I have

return CMap::mergeArray(



        'dateFormats' => array(

            'full' => 'EEEE d MMMM Y',

            'long' => 'dd MMMM yyyy',

            'medium' => 'dd/MM/yyyy',

            'short' => 'dd/mm/yy',





What’s wrong?


changing in config/main.php


and in my i18n/data/it.php


works for both web and console