3

以下のチュートリアルを使用して、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://[サイトURL]/fre/posts/edit/3

route.php で渡したルーティングの原則に問題があると思います

私を助けるためにあなたの提案を送ってください。

前もって感謝します

4

1 に答える 1

2

言語を切り替えながらリンク生成にパラメータを追加することで、上記の問題の簡単な解決策を試しました。

<?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')); 
?>
于 2012-09-16T18:53:11.270 に答える