zendframework多语言配置(默认语言文件)
/*****************module.config.php******************/ 'service_manager' => array( 'aliases' => array( 'translator' => 'MvcTranslator', ) ), //配置 'translator' => array( 'locale' => 'zh_CN', 'translation_file_patterns' => array( array( 'type' => 'gettext', 'base_dir' => __DIR__ . '/../language',//路径根据实际情况修改 'pattern' => '%s.mo' ) ), 'translation_files' => array( array( 'type' => 'phparray', 'filename' => __DIR__ . '/../../../vendor/zendframework/zendframework/resources/languages/zh/Zend_Validate.php', ), array( 'type' => 'phparray', 'filename' => __DIR__ . '/../../../vendor/zendframework/zendframework/resources/languages/zh/Zend_Captcha.php', ), ), ), /******************Module.php********************/ public function onBootstrap(MvcEvent $e) { \Zend\Validator\AbstractValidator::setDefaultTranslator($e->getApplication()->getServiceManager()->get('translator')); }
posted on 2015-08-26 19:31 darkness_1 阅读(264) 评论(0) 编辑 收藏 举报