开发者

zend translate for view & controller

开发者 https://www.devze.com 2023-01-23 13:31 出处:网络
I initialize translation in controller. public function init(){ $this->translate= new Zend_Translate(\'csv\', \'../application/configs/translate.tr\', \'tr\');

I initialize translation in controller.

public function init(){
  $this->translate  = new Zend_Translate('csv', '../application/configs/translate.tr', 'tr');

But I want to use translate in view. Should I initialize as the same way as controller?开发者_运维百科 How can I implement what?


Just initialize the translation in application.ini. The application resource will we available everywhere.

Example:

resources.translate.registry_key = "Zend_Translate"
resources.translate.adapter = "gettext"
resources.translate.options.logUntranslated = false
resources.translate.options.scan = "directory"
resources.translate.options.disableNotices = 1
;resources.translate.options.logfile = APPLICATION_PATH "/../data/log/application.log"
resources.translate.data = APPLICATION_PATH "/../data/languages"
resources.translate.locale = "fr" ; default language

You may also get Zend_Translate instance from the registry.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号