开发者

zend translate for view & controller

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜