On Jun 8, 3:36 pm, trickal <[EMAIL PROTECTED]> wrote:
> Hi,
>
> as a cake newbe I'am also playing around with the translation
> behaviour. This thread helped my much to get it working.
>
> Right now I'm stucked with creating localized model records. This
> works smoothly if i create a model record for each locale (lets say
> article 1 for locale de_de, article 2 for locale en). But it fails if
> I try to create 1 to n translations for a model record (article 1 for
> locale de_de und locale en). This what I'm trying to do:
>
> // create new article record
> function create() {
> if (isset ($this->data['Article']['locale'])) {
> $this->Article->locale = $this->data['Article']['locale'];
> }
> if (!empty($this->data)) {
> if ($this->Article>save($this->data)) {
> $this->flash('Article been saved.', '/articles');
> }
> }
>
> }
>
> // update article record, this may mean that a new translation is
> added or an old one is updated
> function update($id = null) {
> if (empty ($this->data)) {
> $this->Article->id = $id;
> $this->data = $this->Article->read();
> } else {
> // set locale
> if (isset ($this->data['Article']['locale'])) {
> $this->Article->locale =
> $this->data['Article']['locale'];
> }
> if ($this->Article->save($this->data['Article'])) {
> $this->flash('Article has been updated.',
> '/articles');
> }
> }
>
> }
>
> There is a way to accomplish this by changig the beforeFind and
> afterSave methods of the TranslateBehavior class but fear that I may
> have overlooked something. Any suggestions on that?
>
> Thanks,
This is something I really want to know too!
All works fine when I INSERT the Articles and their translations
manually into MySQL - I can edit and delete the Article.
But how can you INSERT for example an Article in german and then save
the english version of the article without creating a complete new one
which has no relation to the german one??
I tried to set ['Article']=>['locale'] in my form in the view and in
$this->data but it did not work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---