i'm trying to create a multilingual node using a php script.
I'm doing this:
$node = new stdClass(); $node->title = "Test ".mktime(); $node->type = "job"; $node->language = 'de'; // Or e.g. 'en' if locale is enabled $node->uid = $user->uid; $node->status = 1; //(1 or 0): published or not $node->promote = 0; //(1 or 0): promoted to front page $node->comment = 1; //2 = comments on, 1 = comments off $node->path = array('alias' => 'das-ist-ein-test-'.mktime()); $node->body[$node->language]['value'] = "Body Body Body"; $node->body[$node->language] = text_summary("Body Body Body"); $node->body[$node->language] = 'filtered_html'; node_save($node);
As long as i set $node->language to 'und' everything is working fine. But as soon as I set the language to 'de' or 'en' (both languages are activated in my Drupal installation) the body text doesn't get saved.
So my question is: can anybody provide me with a working example of how to store a multlingual node (de,en) into Drupal using program code.