yii配置语言包

1、将framework下message目录下的config.php复制到应用程序的message目录下。如:

cp yii/framework/message/config.php test/protected/message/config.php
2、修改config.php文件,如需要需要英语
<?phpcd test/protected
./yiic message “../protected/messages/config.php”
/**
* This is the configuration for generating message translations
* for the Yii framework. It is used by the ‘yiic message’ command.
*/
return array(
‘sourcePath’=>dirname(__FILE__).DIRECTORY_SEPARATOR.’..’,
‘messagePath’=>dirname(__FILE__).DIRECTORY_SEPARATOR.’..’.DIRECTORY_SEPARATOR.’messages’,
‘languages’=>array(‘es’),
‘fileTypes’=>array(‘php’),
‘exclude’=>array(
‘.svn’,
‘yiilite.php’,
‘yiit.php’,
‘/i18n/data’,
‘/messages’,
‘/vendors’,
‘/web/js’,
),
);
3、使用yii message将抓取语言包
cd test/protected
./yiic message “../protected/messages/config.php”
4、main.php中配置
‘language’ => ‘zh_cn’,