On 10 Jul., 12:34, "jitka (poLK)" <[EMAIL PROTECTED]> wrote: > > I tried to set ['Article']=>['locale'] in my form in the view and in > > $this->data but it did not work. > > You have to change (in controller) $this->Article->locale property. It > defaults to null (autodetection), but you can set it to any locale > string - see L10n::$__l10nMap ($locale => $language)
I still don't get it. I'll post some code I have: My Model: <?php class Post extends AppModel { var $name = 'Post'; var $actsAs = array('Translate' => array('title' => 'TranslationsAbstract', 'body' => 'TranslationsAbstract')); } ?> What are the differences between 'TranslationsText', 'TanslationsAbstract' and 'Translations' by the way? index, edit and add action of my PostsController: <?php ... function index($locale = 'deu') { $this->Post->locale = $locale; $this->Post->recursive = 0; $this->set('posts', $this->Post->findAll()); } function add() { $this->Post->locale = 'deu'; if (!empty($this->data)) { $this->cleanUpFields(); $this->Post->create(); if ($this->Post->save($this->data)) { $this->flash('Post saved.', array('action'=>'index')); exit(); } else { } } } function edit($id = null) { $this->Post->locale = 'en'; if (!$id && empty($this->data)) { exit(); } if (!empty($this->data)) { $this->cleanUpFields(); if ($this->Post->save($this->data)) { $this->flash('The Post saved.', array('action'=>'index')); exit(); } else { } } if (empty($this->data)) { $this->data = $this->Post->read(null, $id); } } I have "hardcoded" the $this->Post->locale = ... in the add and edit actions intentionally for test purposes. Also not that the $locale parameter in the index action is just for test purposes only to switch fast between english and german versions for the posts/index action via url Then I went to the edit action for the just added post, what I got was the edit page with an empty form. I typed the english title and body for the post and saved it, but cake did not do an UPDATE on the german post I added previously but INSERTed a completely new Post which shows only on the /posts/index/ deu page but not on /posts/index/en. So I have 2 different posts on the german index page and none on the english. What have I done wrong? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---