node_save() not working with LANGUAGE_NONE My question is exactly similar to the one posted here
https://www.drupal.org/node/2324047.

The answer posted here is not complete and I'm looking for a solution. I'm using the below code to save a node.

function api_add_getabstract($node_values, $api_endpoint) {
  //initialise node object
  $ex_node = new stdClass();
  $ex_node-&gt;type = 'getabstract';
  $ex_node-&gt;language = 'en';
  node_object_prepare($ex_node);
  dpm($node_values,'node values');

  //add field values
  $ex_node-&gt;title = $node_values['bookinfo']['title'];
  $ex_node-&gt;body['en'][0]['value'] = $node_values['recommendation'];
  $ex_node-&gt;body['en'][0]['format'] = 'full_html';
  $ex_node-&gt;field_authors['en'][0]['value'] = $node_values['bookinfo']['authors'];
  $ex_node-&gt;field_sub_title['en'][0]['value'] = $node_values['bookinfo']['subtitle'];
  $ex_node-&gt;field_publisher['en'][0]['value'] = $node_values['bookinfo']['publisher'];
  $ex_node-&gt;field_ex_cover_image['en'][0]['value'] = $node_values['bookinfo']['bookcoverOriginal'];
  $ex_node-&gt;field_ex_deep_link['en'][0]['value'] = $node_values['publicURL'];
  $ex_node-&gt;field_api_info['en'][0]['value'] = $api_endpoint;
  node_save($ex_node);
}


I tried by changing the value 'en' to 'und' and LANGUAGE_NONE, but none seem to save the node completely. Using 'en' at least creates the node with only Title field, but for the other 2 values, node is not even getting created.
I presume by your code example you use D7. And I presume by the error you get you don't use Entity Translation.

In D7 the built-in approach to offer multilingual content is called 'content translation'. Meaning you translate node by node. You hit the language switch and get redirected to another node.

Whereas in D8 the Entity Translation module now became part of core and so it replaced the 'content translation' approach by the 'entity translation' approach. Meaning you translate field by field. By providing a language key for every field. You hit the language switch and the same node reloads, but this time rendering the field values in a different language.

To come back to your question, as you don't use Entity Translation, you only have to set a language for the node (and possibly map it to their matching nodes in other languages). You MUST NOT specify a language for each field.

Alternatively, start using Entity Translation and configure the fields you want to be multilingual. Then, if I remember it right, your code will work.

Comparing both approaches, each has its pros and cons. And I already built D8 sites where we had to somehow rebuild a custom 'content translation' workflow (node by node translation), to get back the flexibility this has (especially in connection with Paragraphs – but that's a different story to be told).