Ability to customize locale files

Just as we can keep our customized version of the core messages in our application directory, it’d be nice that we could do the same with the locale data files (for correcting errors, customizing date format definitions, etc).

One quick way to achieve this would be to change the CLocale constructor to:


protected function __construct($id)

{

  $this->_id=self::getCanonicalID($id);

  $dataFile=Yii::getPathOfAlias('application').DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.$this->_id.'.php';

  $exists = is_file($dataFile);

  if(!$exists) {

    $dataFile=dirname(__FILE__).DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.$this->_id.'.php';

    $exists = is_file($dataFile);

  }

  if($exists)

    $this->_data=require($dataFile);

  else

    throw new CException(Yii::t('yii','Unrecognized locale "{locale}".',array('{locale}'=>$id)));

}

This would look first for the locale file inside the application protected/i18n directory, and when not found it would use the default framework location.

Could you please submit a ticket for this? Thanks!

Are there any plans to include this patch or implement the ability to extend the CLocale class in nearest Yii releases?

Currently, Yii v.1.0.11 uses CLocale as a singleton in a number of places and I can’t find the right way to extend it.

I also need this functionality. I didn’t see a ticket so I just created one

http://code.google.com/p/yii/issues/detail?id=2089