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 translation has been synchronized.“ 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | i18n-sync-1312946-2.diff | 845 bytes | cyberwolf |
Comments
Comment #1
torotil commentedNote 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").
Comment #2
cyberwolf commentedHaving 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.
Comment #3
zilverdistel commentedComment #4
zilverdistel commentedComment #5
jose reyero commentedYes, this makes sense. Committed, thanks.
Comment #7
torotil commentedI'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.Comment #8
torotil commented* Uploading another image (if one is present already) works just fine.
Comment #9
my-family commentedI 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.
Comment #10
jose reyero commentedFrom #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.
Comment #11
jose reyero commentedComment #12
jose reyero commentedNo follow up, closing.