Add a disclaimer message

Created on 25 April 2025, 2 months ago

Problem/Motivation

Machine translation is not yet as perfect as human translation, so a message needs to be displayed to notice the user that this is a machine translation.

Proposed resolution

Create a message block with a disclaimer text.

✨ Feature request
Status

Active

Version

1.1

Component

Code

Created by

🇭🇺Hungary peri22

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

Merge Requests

Comments & Activities

  • Issue created by @peri22
  • Merge request !25Issue #3521121 Add disclaimer message. → (Open) created by peri22
  • Pipeline finished with Success
    2 months ago
    Total: 219s
    #481775
  • 🇭🇺Hungary peri22

    I created a new service to check whether the translation is an ec_etranslation job and to build the warning message. I also created a block plugin to display the message when needed.

    If you'd like to use the disclaimer, you can either place the block in the appropriate location or add the message from a preprocess function, like this:

    if ($translationHelper->isEcEtranslationJob($comment)) {
        $variables['content']['content']['notification'] = $translationHelper->buildWarningMessage($comment, $sourceLanguage);
    }
    

    I plan to enhance the solution by allowing the message type and text to be configurable.

  • 🇧🇪Belgium dieterholvoet Brussels

    dieterholvoet → changed the visibility of the branch 1.x to hidden.

  • Pipeline finished with Success
    about 2 months ago
    Total: 171s
    #484664
  • 🇭🇺Hungary peri22

    I’ve added new fields to the provider settings form to make the Disclaimer notification configurable. You can now choose whether to display the notification and customize its type, title, and message. The message is also translatable.

  • Pipeline finished with Success
    about 2 months ago
    Total: 335s
    #484672
  • 🇷🇴Romania claudiu.cristea Arad 🇷🇴

    Before going to review the code:

    • What happens if the jobs are purged? See tmgmt_cron().
    • I wonder if this feature should live here or in a submodule
  • 🇷🇴Romania claudiu.cristea Arad 🇷🇴
  • 🇧🇪Belgium herved

    (note: I am not a maintainer but) I do have some architectural concerns as well.

    What happens if the jobs are purged? See tmgmt_cron().

    This, also jobs can be deleted manually.

    Currently, the block shows the message if there is an accepted/completed job item for the given entity type, ID and language.
    But what about the revision? should that be taken into account?
    Also, what if the entity was translated with tmgmt but using another source plugin?
    To me this looks more like some business logic that could vary greatly depending on the site.

    Maybe this can be implemented as a base field (revisionable, translatable) in the entity.
    But of course it would need to be set on the translation upon save. I did find ✨ Hook to allow modules to alter translation entity being created RTBC which may help on that.

  • 🇬🇷Greece idimopoulos

    I agree that this is kind of too business logic related.
    This adds generic properties to the block (correct) but it adds specific logic to the code with some hardcoded values (like the etranslation).
    I would say that this would be better if it would go generically in TMGMT module with the following:
    * Provide the possibility to show messages.
    * Select manually which plugins this message is shown for
    * Provide the messages and the type
    * Maybe additionally allow to select the languages to show the message for.
    * Explain in a help text something like "this can be useful if for example you want to inform the user that this is a machine translation or that translations might not be accurate in some languages"

  • 🇷🇴Romania claudiu.cristea Arad 🇷🇴

    Thank you for your contribution.

    Looking a the proposal, here are my points:

    • This is a feature that should NOT be strictly a tmgmt_ec_etranslation stuff. It should cover all machine translators
    • Problem is: I don't think there's a way to automatically determine which translator plugin uses a "machine translation"
    • A workaround would be a configuration where the site builder declares which translators are considered by them as "machine" translators

    That said, I don't see the place of this feature in tmgmt_ec_etranslation. My suggestion is to create a new module that only depends on https://www.drupal.org/project/tmgmt → and which tries to solve this issue in a generic way, for all machine-based translators.

    Still, relying on job records seems a weak option to me, as is mentioned already in #6 and #8. Maybe there's other way to mark an entity as machine-translated?

    I will mark this as "won't fix".

  • 🇵🇱Poland piotrsmykaj

    I added a patch with a few fixes here to keep it on drupal.org.

Production build 0.71.5 2024