[support] Multilingual fields in D7

Henry Hu henryhu712 at gmail.com
Fri Nov 23 03:55:35 UTC 2012


Hi folks,

I encountered a weird issue. Create a node programmatically:

  $gloss = new stdClass();
  $gloss->type = 'term';
  node_object_prepare($gloss);

  $gloss->title = "default title";
  $gloss->language = "en";
  $gloss->field_description['und'][0]['value'] = "Some description";
  node_save($gloss);

So far, everything is ok. The node is created correctly. Then I intend
 to get field_description specified a language, like English. So
change the line to :

  $gloss->field_description['en'][0]['value'] = "Some description";

This time, the node is created without saving the value of
field_description. Why it fails when specifying a language for a
field? The issue appears on my production site, and on a test site no
problem. So I guess I miss some multilingual configuration. I enabled
i18n module.

Thanks for any suggestion.

Regards,
Henry


More information about the support mailing list