How can I clone all field values when creating a node translation (entity_translation) programmatically? I use entity_translation and have an en node currently without translations. Assume it has fields field_foo and field_bar so currently they are:

$node-&gt;field_foo['en'][0]['value'] = 'foo';
$node-&gt;field_bar['en'][0]['value'] = 'bar';


I want to programmatically add anfr translation but only translate field_foo so I do:

$node-&gt;field_foo['fr'][0]['value'] = 'foo FR';

entity_translation_get_handler('node', $node)-&gt;setTranslation(array(
  'translate' =&gt; 0,
  'language' =&gt; 'fr',
  'source' =&gt; 'en'
), $node);
field_attach_update('node', $node);


This works but now if I edit (or devel) the fr node, field_bar is empty. On the frontend it does show "bar" which is the en value, but I've noticed that if I create the translation via the Drupal UI then the field_bar is not empty and contains a copy of the en value.

So, does anyone know of a way that the API will copy all values upon translation creation? Or should I be doing that myself manually via the code?
I ended up doing it manually via code:

function _populate_translation_values($node, $targetLanguage) {
  $fields = field_info_instances('node', $node-&gt;type);
  foreach($fields as $fieldName=&gt;$fieldInstance) {
    $fieldInfo = field_info_field($fieldName);

    // only process translatable fields
    if (!$fieldInfo['translatable']) continue;

    // ignore fields which are complicated to copy - could be fixed in the future
    if (in_array($fieldInfo['type'], array('field_collection'))) continue;

    // skip fields which already have a value in the target language
    if (isset($node-&gt;{$fieldName}[$targetLanguage])) continue;

    // skip fields which don't have a value in the source language
    if (!isset($node-&gt;{$fieldName}[$node-&gt;language])) continue;

    // copy value
    $node-&gt;{$fieldName}[$targetLanguage] = $node-&gt;{$fieldName}[$node-&gt;language];
  }
}