Tuesday, July 26, 2011

Re: Multilanguage in CakePHP 1.3

Now ive got it!

app/config/routes.php

Router::connect(
'/:lang/:controller/:action/*',
array(),
array('lang' => '[a-z]{2}')
);
Router::connect(
'/:lang/:controller',
array('action' => 'index'),
array('[a-z]{2}')
);

cake/libs/controller/app_controller.php

var $components = array('Session', 'Cookie');

function beforeFilter() {
$this->_setLanguage();
}

function _setLanguage() {
if ($this->Cookie->read('lang') && !$this->Session-
>check('Config.language')) {
$this->Session->write('Config.language', $this->Cookie-
>read('lang'));
}
else if (isset($this->params['lang']) && ($this->params['lang']
!= $this->Session->read('Config.language'))) {

$this->Session->write('Config.language', $this-
>params['lang']);
$this->Cookie->write('lang', $this->params['lang'], false,
'20 days');
}
}

and last set default language in app/config/core.php

Configure::write('Config.language', 'de');

Thats all and i took 2 Days with this :(

gloop

On 25 Jul., 22:54, gloop <gl...@web.de> wrote:
> Sorry,
>
> i forgett the S in my post.
>
> It doesn't work with LC_MESSAGES
>
> On 25 Jul., 21:38, euromark <dereurom...@googlemail.com> wrote:
>
>
>
>
>
>
>
> > your double post has already been answered in the german grouphttp://www.cakephp-forum.com/installation-und-konfiguration/multilang...
>
> > LC_MESSAGES instead of LC_MESSAGE
> > will most likely this fix your problem
>
> > On 25 Jul., 21:10, Davor Ilic <webfa...@gmail.com> wrote:
>
> > > sry habe wohl eine zeile nicht gelöscht
>
> > > $this->set('home', $this->Setting->field('set_kat_id'));// das hier
> > > rausnehmen weil dieses model kommt aus meinem controller sry hab gedacht ich
> > > hätte sachen gelöscht die du nicht benötigst bzw nicht hast
>
> > > Am 25. Juli 2011 21:07 schrieb gloop <gl...@web.de>:
>
> > > > CORE

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments:

Post a Comment