Forums / Developer / Object translation / Comment51348

Author Topic

Carlos Revillo

Monday 13 July 2009 2:10:36 pm

Comment51348

Hi. you can try something like this, supposing english as your main language and catalan as the second one

$object = eZContentObject::fetch( $objectID );

$catalanVersion = $englishObject->createNewVersion( $object->CurrentVersion, true, 'cat-ES', 'eng-GB' );
  
$contentObjectAttributes = $catalanVersion->contentObjectAttributes();

$contentObjectAttributes[0]->setAttribute( 'data_text', $whatever);
$contentObjectAttributes[0]->store();

//fill all your attributes here

eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $catalanVersion->ContentObjectID,
 'version'  =>  $catalanVersion->Version ) );

hope it helps