【问题标题】:Language Translation Issue with CakephpCakephp 的语言翻译问题
【发布时间】:2012-09-08 05:53:57
【问题描述】:

我使用以下教程使用 cakePHP 2.0 开发了一个简单的语言翻译模块:

http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/

它工作正常 如果我在 URL 下面运行 http://[SITe_URL]/posts/index

语言翻译链接正在转换为 http://[SITe_URL]/eng/posts/index http://[SITe_URL]/fre/posts/index

但如果我通过一个低于 URl http://[SITe_URL]/posts/edit/3

语言翻译链接正在转换为 http://[SITe_URL]/eng/posts/edit http://[SITe_URL]/fre/posts/edit

而不是

http://[SITe_URL]/fre/posts/edit/3

我认为我在 route.php 中传递的路由原则存在问题

请将您的建议发送给我以帮助我。

提前致谢

【问题讨论】:

    标签: cakephp routing cakephp-2.0 language-translation


    【解决方案1】:

    我尝试通过在切换语言时在链接生成中添加额外参数来解决上述问题。

    <?php 
        $param = null;
        if(isset($this->params['pass'][0]))
            $param = $this->params['pass'][0];
        echo $this->Html->link('English', array($param,'language'=>'eng'));
        echo ' | ';
        echo $this->Html->link('French', array($param,'language'=>'fre')); 
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 2013-03-10
      • 2012-03-25
      • 1970-01-01
      • 1970-01-01
      • 2011-02-09
      • 1970-01-01
      相关资源
      最近更新 更多