Cakephp 2.6 internationalization
<p>I was doing translation for my website using i18n and translate behavior.</p>

<p>Once the user click on the change language button. All the text and records will be shown in Chinese.</p>

<p>But,</p>

<p>when user click on other pages, only the text translated through i18n still displaying in chinese. The database records are showing back to original which is english.</p>

<p>this is the code in the AppController</p>

<pre><code>function beforeFilter() {
    $this-&gt;_setLanguage();
}

private function _setLanguage() {

//if the cookie was previously set, and Config.language has not been set
//write the Config.language with the value from the Cookie
    if ($this-&gt;Cookie-&gt;read('lang') &amp;&amp; !$this-&gt;Session-&gt;check('Config.language')) {
        $this-&gt;Session-&gt;write('Config.language', $this-&gt;Cookie-&gt;read('lang'));
    } 

//if the session was previously set, and cookie language has not been set
//write the cookie language with the value from the session

    else if (!$this-&gt;Cookie-&gt;read('lang') &amp;&amp; $this-&gt;Session-&gt;check('Config.language')) {
        $this-&gt;Cookie-&gt;write('lang', $this-&gt;Session-&gt;read('Config.language'));
    }
    //if the user clicked the language URL

    if ( isset($this-&gt;params['language']) ) { 
        //then update the value in Session and the one in Cookie
        $this-&gt;Session-&gt;write('Config.language', $this-&gt;params['language']);
        $this-&gt;Cookie-&gt;write('lang', $this-&gt;params['language'], false, '20 days');
    }
}
</code></pre>

<p>I am wondering where did I went wrong?</p>

<p>Can anybody help?</p>

<p>Thanks</p>