Content moderation options in entity translations

Created on 21 June 2025, 12 days ago

Problem/Motivation

For one-click entity translations, the content flow (without using other modules like tmgmt) is hard-coded: "published" state of newly created translation is taken from from original entity, entity translation is created and user is redirected to the content translation overview. Also, AI Translate can only create entirely missing translations, but not to update translations of certain fields.

Proposed resolution

  • Add "Translation status" setting in AI Translate settings form. Possible values "keep the status of original entity" and "create translation in draft status". Sub question: should this be global setting, or global setting + per entity/bundle settings?
  • Add (wording TBD) setting on what to do after creating a new translation: return to content translation overview, or go to edit translation form

Data model changes

2 new settings in the schema of ai_settings config entity, need to update the defaults.

Feature request
Status

Active

Version

1.2

Component

AI Translate

Created by

🇧🇬Bulgaria valthebald Sofia

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

Merge Requests

Comments & Activities

  • Issue created by @valthebald
  • Pipeline finished with Failed
    8 days ago
    Total: 202s
    #530977
  • Pipeline finished with Success
    8 days ago
    Total: 199s
    #530979
  • 🇮🇳India annmarysruthy

    Raised MR !696. Added a "Translation status" setting to AI Translate config. You can now choose to keep the original entity's status or always create translations as drafts. It's a global setting for now — per-entity/bundle config can be explored later if needed. Redirect behavior setting not included in this MR.

  • 🇮🇳India anjaliprasannan

    I have review the MR.
    But on translation on any option selected the translated content is saved as published. It is not keeping the currect status of the original node.

    Steps followed:

    1. Enabled translation for the content article.
    2. Added additional language.
    3. Moved the original content to draft state
    4. Selected the "Keep the status of original entity" option in ai translation settings and saved.
    5. tried translating article content
    6. The translated content is saved as published.
    7. Go back to ai trsnslation settings and change the option to "Create translation in draft status" and tried translating the content.
    8. The translated content is saved as published.
  • First commit to issue fork.
  • 🇳🇴Norway efpapado

    Here is another approach, where 2 options are offered on-the-fly, without any need for configuration changes: Keep the original translation status, or forcibly save the translation as unpublished.

  • 🇧🇬Bulgaria valthebald Sofia

    I have the same behavior as @anjaliprasannan

  • Pipeline finished with Failed
    6 days ago
    Total: 431s
    #533164
  • 🇧🇬Bulgaria valthebald Sofia

    @efpapado: I'm afraid your approach creates an option to permission bypass, i.e. by manually adding 1 to the link, user will be able to publish an entity even if they don't have access to

  • 🇳🇴Norway efpapado

    Hi, adding 1 (or anything trueish) forces the translation to be saved as unpublished (TRUE => force unpublished).
    Adding 0, or nothing, will just fall back to the current behaviour. If there is an access bypass issue, (I haven't checked) it is not introduced by this patch.

  • 🇧🇬Bulgaria valthebald Sofia

    @efpapado: oh, I didn't realize that.
    Still, I'd prefer the approach in https://git.drupalcode.org/project/ai/-/merge_requests/696 - I don't think it's the site builder who decides what is the translation flow (i.e. is the AI-translated page gets published), but the site administrators.

  • 🇳🇴Norway efpapado

    @valthebald:
    No strong opinions, sharing thoughts:

    I don't think it's the site builder who decides what is the translation flow (i.e. is the AI-translated page gets published), but the site administrators.

    If someone has the permission to publish translations, why would it be different if the translations are manually added through drupal's UI, or automatically (but still, manually triggered) through a request to some AI tool?
    We should just follow the normal permissions related to translating content. Would adding an extra layer of permissions/settings worth the complexity?
    One might be confident enough to not require manual control and wanting to publish immediately, or might want to have a manual review first.

  • 🇧🇬Bulgaria valthebald Sofia

    @efpapado: we could argue on possible reasons to change the flow, but there's more:
    1. UI change - "Translate using ... " already takes significant part of the translation list screen, if we have 2 options instead of one, the screen would look like this:

    This doesn't seem an improvement of UX. Maybe those options can go to the actions list (Add/Edit/Delete)?
    2. More importantly, "force save unpublished" doesn't take any effect, I still get a published entity if the original entity is published.

  • 🇧🇬Bulgaria valthebald Sofia

    @efpapado: there could be an option to match both flows, and this is "let the user decide" option in
    AiTranslateSettingsForm::buildForm (see the second MR):

    
          '#options' => [
            'keep_original' => $this->t('Keep the status of original entity'),
            'create_draft' => $this->t('Create translation in draft status'),
            'user_decision' => $this->t('Let the user decide'),
          ],
    

    but in any case, non-unpublishing the translation is the bigger target to hit

  • 🇧🇬Bulgaria valthebald Sofia

    After some debugging, the reason for the status being kept as "Published" is \Drupal\content_moderation\EntityOperations::entityPresave() that checks $entity->moderation_state field but not the "published" key (which is changed indirectly.

    Needs to be tested how this affects the published status of original entity (it should stay intact)

Production build 0.71.5 2024