I have a setup with two languages and two nodes (one 'en' and one 'de'). The content type has a image field that allows multiple uploads. The field is set up to synchronize.

When I upload the first image to the 'en'-node and save the node it says: „One node trans­la­ti­on has been syn­chro­ni­zed.“ But the image doesn't appear in the 'de'-node. A look at the database reveals that there is indeed an entry for the 'de'-node in field_data_field_* but it's language is set to 'und'.

  • After manually setting the language to 'de' the image can be seen in the 'de'-node as expected.
  • Uploading more images works just fine.
  • Deleting all images in the field, saving the node, uploading a new one and the bug is visible again.
#2 i18n-sync-1312946-2.diff845 bytesCyberwolf
Members fund testing for the Drupal project. Drupal Association Learn more


torotil’s picture

Note that field_language() is indeed returning 'und' for those fields. That is because in locale_field_language_fallback (modules/locale/locale.module:479) the field is empty. I'm unsure whether this problem isn't better fixed upstream ("field_language() shouldn't return 'und' for empty image fields").

Cyberwolf’s picture

845 bytes

Having a similar issue here, not just for image fields, but just any field which is left empty initially. As far as my understanding of the field API goes, I believe field_language() is not intended to be used to retrieve the language to save data in, and should only be used to retrieve the best language the field has values available for, to display them. Attached is a small patch that uses the entity language if the field is translatable, otherwise if the field is not translatable it uses LANGUAGE_NONE.

zilverdistel’s picture

Status: Active » Needs review
zilverdistel’s picture

Status: Needs review » Reviewed & tested by the community
Jose Reyero’s picture

Status: Reviewed & tested by the community » Fixed

Yes, this makes sense. Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

torotil’s picture

Version: 7.x-1.1 » 7.x-1.4
Status: Closed (fixed) » Needs work

I've just set-up another site using the 7.x-1.4 and there is still a problem with the approach from above.
I have an image field that is set to be not-translateable but set to synchronize between translations. This leads to the following behavior:
* If I upload the first image in any of the nodes in the translation-set. It doesn't synchronize at all. There is no entry in the field_data_* table for the other nodes.
* If I have one image uploaded and synchronized (manually) and remove it it is also removed in all translations.
* If I modify the line from the patch above to be:$translation_lang = $entity->language;everything works as expected.

torotil’s picture

* Uploading another image (if one is present already) works just fine.

my-family’s picture

I have (probably) the same problem with Drupal 7.12 and i18n 7.x-1.4. ALL fields, (synchronized or not), have the "und" key in the array structure, although the $node->language is right (cs or en, NEVER undefined).

Thank you in advance for help.

Jose Reyero’s picture

From #7>

I have an image field that is set to be not-translateable but set to synchronize between translations.

So it looks like you are using entity translation for that content type, right?

If so, the real bug is allowing ET node types to have synchronized fields.

Jose Reyero’s picture

Status: Needs work » Postponed (maintainer needs more info)
Jose Reyero’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No follow up, closing.