i've created a whole workaround for that:

function in app_model:

[code]
public function _setLocales($data,$id){
                $languages = Configure::read('app.languages');
                $saved=0;
                foreach($languages as $key => $lang){
                        if($key == 'en') continue;
                        $this->locale=$lang['locale'];
                        $this->data['locale']=$lang['locale'];
                        $this->data=$data[$key];
                        $this->save($this->data);
                        $saved++;
                }
                $this->locale=$languages[$this->default_lang]['locale'];
                return $saved;
        }

[/code]

in admin_add.ctp the form is like that (locale is EN):

[code]

<? echo $form->input("$model.title"); // that will save the title in
English?>
<? foreach($languages as $k=>$l){ if($k=='en') continue; // this will
save titles in all other languages?>
<?=$form->label("Version.$k.$model.title",'title '.up($k))?>
<input type="text" value="<?=$this->data['Version'][$k][$model]
['title']?>" id="Version<?=$k?>EditionTitle" name="data[Version][<?=$k?
>][Edition][title]" />
<? }?>

[/code]

in controller:

$this->{$this->modelClass}->save($data);
$saved=$this->{$this->modelClass}->_setLocales($data['Version'],$this->
{$this->modelClass}->id);

On Dec 13, 11:12 pm, DigitalDude <[email protected]> wrote:
> Hey,
>
> I managed to create the db-table for i18n (thanx to 'cake i18n'
> hehe :) ) and attached the "Translate" Behaviour to my Model for which
> I want to save let's say the title in 3 different languages.
>
> I also made a 'title' => 'translateTitle' in my model, because I read
> that in this case all languages are queried for a record.
>
> Now I'm wondering, what I'm doing wrong. When I chose "Englisch"
> language from my top-navigation, a record is saved in englisch (as we
> all expected). When I then switch to "German", the record won't be
> schown anymore, which is a little bit strange I think. If I save
> antoher record, it will be displayed because the current language
> matches the saved one from the database.
>
> So I'm assuming Cake only shows records which are stored under the
> locale the system is set to for the moment, which is ok in most cases.
>
> I was wondering if there's a chance to have 3 inputs in a form for the
> different languages and I could save this only ONE time but then have
> all 3 languages saved to the DB?
>
> The CookBook shows you how a record with multiple languages is echoed
> and how it's structured, but it is completely missing the main thing,
> which is HOW I save a record so I have this very important option?
>
> Also I think it would be great that if a specific locale version of a
> record is not found, (for example, you chose englisch but the record
> is only saved in german) it should show this record.
>
> Any ideas?
>
> Regards,
>
> DD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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

Reply via email to