Fields Content Deletions of (already Translated) Entity Content are not reflected in new Translations updates

Created on 3 May 2022, about 2 years ago
Updated 28 February 2023, over 1 year ago

Problem/Motivation

When some field content is deleted from an already Translated Content Entity it is not reflected in its Translations updates.
The field is still present with the same (translated) content from the previous version/revision ...
This happens to me both in the source Content and both in Paragraphs (or other fieldable entities) attached/referenced to the source Content.

Steps to reproduce

  1. Create a Content Entity (assume a Node) with Title and a text field (assume it is called "text_field"), and fill both of them with some content (Version 1);
  2. Require Translation (let's assume for Spanish Language) for the Node Content Entity, and have them accepted back. Both the Title and the "text_field" will have their Spanish Translation (Version 1) ...
  3. Amend the Title field content (Version 2) and just delete the content for the "text_field" (that becomes empty).
  4. Re-require the Translation (for Spanish Language) for the Node Content Entity.
  5. I expect the Title field to have the Spanish Translation updated to its Version 2 and the "text_field" now empty (correctly reflecting the source field state). But the "text_field" is instead still filled with the Spanish Translation (Version 1) ... and this is wrong/un-wanted.

This is a general problem that we are experiencing, and also with referenced Paragraphs: when a Paragraphs field is updated as empty, its translation update will still include its previous translation.

Proposed resolution

From my TMGMT inspection it looks to me that these issues are caused from the logic used to update Content Entity existing translations, from the tmgmt_content submodule, in the Drupal\tmgmt_content\Plugin\tmgmt\SourceContentEntitySource::doSaveTranslations method: https://git.drupalcode.org/project/tmgmt/-/blob/8.x-1.x/sources/content/...

If the Content Entity Translations already exists then ONLY the fields part of the new incoming translations data are updated ...

Instead it could be appropriate, in case of already existing Translation, always remove it (along all its already existing and translated fields) and recreate it from skracth with the new incoming translation ones: as a result only the fields part of the new updated translation will be part of the updated Entity Content Translation, that would perfectly match its source updates, also in terms of deletions.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Core

Created by

🇮🇹Italy itamair

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany D34dMan Hamburg

    I see that, for such cases the ui does detect that the field item was removed.

    Was wondering if it could be possible to "uncheck" the row so that it is not considered for translation. I tried adding an empty field value, but it won't allow me to submit the form :)

Production build 0.69.0 2024