Hello.
I have a site with an english and a greek language. I use the traslate
behaviour as:
class Position extends AppModel {
var $name = 'Position';
var $actsAs = array(
'Translate' => array(
'description' => 'descTranslate',
'full_text' => 'fullTranslate',
'simple_text' => 'simpleTranslate',
'banner_text' => 'bannerTranslate'
));
}
in admin_add() I want to save in both languages. I have in my form:
echo $form->input('description');
echo $form->input('description_en');
echo $form->input('simple_text');
echo $form->input('simple_text_en');
.. [the same for banner and full_text]
In my controller how can I save both the english and greek language?
What I do is:
$original_data = $this->data;
//unset fields that aren't real DB fields
unset($this->data['Position']['description_en']);
unset($this->data['Position']['full_text_en']);
unset($this->data['Position']['simple_text_en']);
unset($this->data['Position']['banner_text_en']);
//first save greek locale
$this->Position->locale = 'gre';
$this->Position->save($this->data)
//change fields with english content and save in
english locale
$this->data['Position']['description'] =
$original_data['Position']
['description_en'];
$this->data['Position']['full_text'] =
$original_data['Position']
['full_text_en'];
$this->data['Position']['simple_text'] =
$original_data['Position']
['simple_text_en'];
$this->Action->locale = 'eng';
$this->Position->save($this->data);
But rows aren't saved correctly. If I set locale='gre' and do a save,
then which language is saved in the positions table and what is saved
in i18n?
thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---