Symmetric translations and content moderation.

Created on 12 January 2022, almost 3 years ago
Updated 30 August 2024, 4 months ago

Hi,

I'm facing an issue which I can't seem to figure out.
At the moment i'm experimenting with layout builder, symmetric translations, content moderation and paragraphs inside inline blocks.

I'm using the core patch for symmetric translations in combination with some other patches

"Layout builder sync translations": " https://www.drupal.org/files/issues/2021-12-22/2946333-9.3.x-266.patch ",
"Layout builder access issues": "https://git.drupalcode.org/project/drupal/-/merge_requests/1106/diffs.patch",
"Layout builder label constraint error": " https://www.drupal.org/files/issues/2021-04-14/custom_block_resuable-305... ",
"Reverting entity revisions that contain custom blocks erroneously triggers EntityChangedConstraint": " https://www.drupal.org/files/issues/2021-10-29/3053881-60.patch "

And for the paragraphs combo I also need some extra patches for paragraphs

"Layout builder compatibility": " https://www.drupal.org/files/issues/2021-05-03/paragraphs-2901390-82-wit... ",
"Fix access problem": " https://www.drupal.org/files/issues/2020-07-08/access-controll-issue-309... "

This works fine when not dealing with content moderation, but when you add content moderation in the mix it gets nasty.
Content moderation forces to hide untranslatable fields on the translation to prevent dataloss.
In the case of symmetric translations, "layout builder layout" is such a untranslatable field.

With the symmetric translation patch applied, you get this error: "Non-translatable fields can only be changed when updating the original language"
This is because you need to be able to edit the layout fields in order to translate the inline blocks.
To overcome this issue many people in the eco system are doing this dirty hack

function my_module_entity_type_alter(array &$entity_types) {
  foreach ($entity_types as $entity_type) {
    $constraints = $entity_type->getConstraints();
    unset($constraints['EntityUntranslatableFields']);
    $entity_type->setConstraints($constraints);
  }
}

But this could lead to dataloss in this scenario:

  1. Create a page in EN and publish, add some inline layout blocks and publish again
  2. Translate page to NL and translate inline blocks
  3. Go back to EN, create a draft and add a new layout block
  4. Go back to NL, change the title and save

Because of the synced layout blocks, the last save will destroy the draft version of the EN page.

When using paragraphs in stead of layout builder this doesn't happen. Changing the title of translation doesn't remove the draft blocks on the original node.

The summary of the module points to the core issue, does that mean the behaviour between the module and the core patch is identical?
Does this module supports content translation?

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium aspilicious

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.

  • 🇨🇦Canada OwilliwO Montreal

    Hi !

    I'm facing the same issue, and have been able to reproduce it on a fresh site-install.

    • Drupal 10.3.1
    • Layout Builder enabled
    • Content translation enabled
    • Language are:
      • default: english
      • other: french
    • Layout Builder Symmetric Translation enabled
    • Content moderation enabled (draft, published, archived)
    • Moderation sidebar enabled

    I've created a content type which is translatable, has the default body/description field and is using layout builder as full display.
    I've allowed users to override the default layout for each node.
    Now, when I create a page in english, then add a simple content block (inline) in the layout, publish my page, then translate it, and go to the translation layout edition, I can translate the block the publish the french version.
    Until here, I'm fine. I can even edit the french or english layouts, as long as it remain published.

    The issues I'm facing start when I create a new draft from my published version (typical usecase: I want to prepare a V2 of my page to publish it later in the evening).
    I create a draft from my english (original) version then add a new block in the layout, with some new content.

    Then I want to prepare the french V2 of my page, but it's impossible, because when editing the translated layout, seems like I'm working on the published revision, instead of the latest.

    This would explain why:

    • I can't see the newly created english block, so I can't prepare its translation
    • if I still try to update the translation, it will only translate the published revision layout

    I plan on investigating this a bit more.
    Obviously any help would be appreciated.

    This is quite a big pain for the edition team on my project: they are not able to prepare both english and french version of an already published page in order to publish both version at the same time. They can "plan" the publication of the new original version, but then they have to set the new translated version ASAP, which can be problematic, especially when several important pages are at stake.

    Composer file attached to this comment.

Production build 0.71.5 2024