回答:
// Define which node is the source, this node has his own id as translation nid (tnid)
$source_node = node_load($source_nid);
$source_node->tnid = $source_nid;
node_save($source_node);
$new_node_in_a_other_language = new stdClass();
$new_node_in_a_other_language->type = 'your_type';
node_object_prepare($new_node_in_a_other_language);
$new_node_in_a_other_language->title = 'title fr';
$new_node_in_a_other_language->language = 'fr';
// define source tnid
$new_node_in_a_other_language->tnid = $source_nid;
node_save($new_node_in_a_other_language);
これは、パネライザやノード構成などの機能を複製するという点で少し良く機能するコードです。
$node_id = 42611;
$source_node = node_load($node_id );
$es_node_404 = clone $source_node;
$source_node->tnid = $node_id ;
node_save($source_node);
// Making cloned node unique.
unset($es_node_404->nid);
unset($es_node_404->vid);
node_object_prepare($es_node_404);
$es_node_404->title = '[ES] ' . $source_node->title;
$es_node_404->language = 'es';
$es_node_404->status = 1;
// Define source tnid.
$es_node_404->tnid = $node_id;
node_save($es_node_404);