Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am having a problem where the user is creating new nodes and entering body text, but setting the nodes to "language neutral" for the language. Yet when it saves the node the body field's language gets set to English. Why would this be happening? What would cause this?

On this site we have both English and French enabled and configured. This site is D7 running i18n.

This is similar to Empty body in node edit page except that I want to know how the field would get a different language than the node in the first place.

share|improve this question
add comment

1 Answer

By default, drupal sets 'und' as the field language, that is LANGUAGE_NONE. So, when you print_r($node), you will see a field with something like $node->field_name['und'][0]['value']

Now, when you enable translation on this field, the 'und' will get replaced by the language code and somehow the $node structure would look like $node->field_name['en'][0]['value'] where 'en' is the language code. Your body field will now have 'en' as the language and won't be empty anymore when rendered

For your question above :

I am having a problem where the user is creating new nodes and entering body text, but setting the nodes to "language neutral" for the language. Yet when it saves the node the body field's language gets set to English. Why would this be happening? What would cause this?

Check default language of your site, if its set to English, then probably Language Neutral will take your site's default language.

share|improve this answer
    
Would be a bit better if you could explain how to enable translation on fields, as it seems you know how to do it, and it isn't obvious. –  Mołot Oct 24 '13 at 7:46
    
@Mołot, Download and install i18n module from : [drupal.org/project/i18n], Now go to Structure > Content Types > 'Content type name' > Manage Fields > 'Edit a field' You will get an option to enable translation, With this you can enable translation on any given field –  gj. Oct 24 '13 at 8:05
    
I meant I can do it, but edit to your answer (for future readers, many of them fresh and green) may be a good idea. If you can bother to do it. You have my upvote for explanation anyway. –  Mołot Oct 24 '13 at 8:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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