0

I'm having a hard time understanding how it supposed to work.

For example I have a node where I set up the language to English. the langcode is en. If I want to read values from a field from this node I will have to do something like:

$node->field_custom[LANGUAGE_NONE][0]["value"]

and not

$node->field_custom[$node->language][0]["value"]

What is the point of having LANGUAGE_NONE for all fields if on all nodes this is the same, no matter what language the node has. Thanks.

1 Answer 1

1

If you use the module Entity translation you have the possibility to say that the body field can be translated but the image field should not be able to be translated.

In your example this would mean

The value of $node->field_body will have different values for the different languages the field is translated to. I.e $node->field_body['en'][0]['value'] could differ from $node->field_body['sv'][0]['value'].

But at the same time the image field will only have value in LANGUAGE_NONE.

Before the most used setup to have a multilingual site was to use the Internationalization module, which would create a new node when a translation of a node was done. The new approach with entity translation translates the fields instead.

Worth noticing, the Internationalization module can be used together with Entity translation. I am only stating the older solution to multilingual sites.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.