What is right way to modify a node field in a multilanguage system (LANGUAGE_NONE or $node->language or ...) Let's say we want to modify the body field.

$node-&gt;body[LANGUAGE_NONE][0]['value'] = "test";


This will work if the node is language neutral (?)

$node-&gt;body[$node-&gt;language][0]['value'] = "test";


This will work if the node has the same langauge as the field. 

But is this always the case? I found nodes where this is not the case:


(Object) stdClass
...
language (String, 2 characters ) de
...
body (Array, 1 element)
  und (Array, 1 element)
        0 (Array, 5 elements)
            value (String, 4 characters ) test


So if this is a correct node, how can we access the body field value?
field_language() returns the field's display language. You should use code similar to the following one: 

$language = field_language('node', $node, 'body');
do_something_with($node-&gt;body[$language][0]);


Of course, note that field_language() will determine the right display language ('en' or LANGUAGE_NONE or whatever); if you're modifying fields you might want to modify more than one language.