【问题标题】:Zend Framework URL assembly ignoring translationZend Framework URL 程序集忽略翻译
【发布时间】:2013-11-25 21:09:22
【问题描述】:

我有以下路线设置:

routeXY.type = "Zend_Controller_Router_Route"
routeXY.route = "@XY"
routeXY.defaults.module = "default"
routeXY.defaults.controller = "index"
routeXY.defaults.action = "actionXY"

然后也在我的翻译数组中配对(XY -> YZ)。

如果我尝试访问已翻译的 URL 片段,例如:

localhost/YZ

我得到了正确的动作“actionXY”。

但是,当我尝试使用查看 url 帮助程序来组装 URL 时,它总是在构建未翻译的 URL。调用:

<?= $this->url(Array('@locale' => Zend_Registry::get('Zend_Locale')), 'routeXY', true);?> 

将语言环境设置为获取“YZ”,获取:

本地主机/XY

如何在汇编过程中强制翻译?

【问题讨论】:

    标签: zend-framework zend-route zend-translate


    【解决方案1】:

    最后,我的理解有点错误。我需要在引导程序默认语言中显式设置,应该从哪个路由进行翻译。此语言必须是“FROM”语言,而不是目标语言:

    Zend_Controller_Router_Route::setDefaultLocale('any_lang');
    

    此语言中的字符串用作默认翻译键。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多