Translate Action for Content Translation module

Created on 12 February 2025, 3 months ago

Problem/Motivation

It seems there is no Action plugin to translate content.
There could be plenty of uses cases, where such Action is needed.
- Just testing multilingual for existing not-trasnlated content
- Move translations to a new language - complete or partial
- The new multilingual structure needs existing/created translation
- ECA models to translate content
- Build multilingual Demos
- ETC ...

Also there could be other contrib needs that could be used in the new Drupal CMS approach / Recipes - Out of the box tools for Site/Content maintainers:
- ECA
- VBO action
- Maybe AI or AI with ECA for translations

Steps to reproduce

- "Try to translate content with an action"

Proposed resolution

Within Content Translation module
- Translatable Action Deriver
- Configurable Translate Action Plugin
-- Source language - what language should be used as source for new translations
-- Target languages - the languages to create translations for.
-- Others if needed - ex. update/override if translation exists, unpublish option ... etc
- Tests

Remaining tasks

- All above

User interface changes

- No changes if the Actions are not "configured"

Introduced terminology

- Translate Content Action

API changes

- This will not change the existing API, but uses the existing API to bring Content Translation Action.

Data model changes

--

Release notes snippet

--

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

content_translation.module

Created by

πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

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

Merge Requests

Comments & Activities

  • Issue created by @vasike
  • Pipeline finished with Failed
    3 months ago
    Total: 160s
    #422279
  • Pipeline finished with Success
    3 months ago
    #422297
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    There is first draft ... using the working code from a project ...

    Using VBO ... as it will work out of the box - for Configurable Action

    However this could easily tested by importing this kind of Action ... check on Admin content for Multilingual site

    langcode: en
    status: true
    dependencies:
      module:
        - content_translation
    id: translate_content_item
    label: 'Translate content item'
    type: node
    plugin: 'entity:translate_action:node'
    configuration:
      source_langcode: en
      target_langcodes:
        fr: fr
        ro: ro
    

    For start:
    - What's not clear?
    - What's missing?
    - Naming (for classes/action) - this big one topic
    - What's next (before testing)

    Put on Needs Review ... till we have some feedback so we could put on Needs Work.

  • Pipeline finished with Failed
    3 months ago
    Total: 114s
    #423068
  • Pipeline finished with Success
    3 months ago
    Total: 548s
    #423078
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    (Kernel) Tests added

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Nice!

    left some comments on the MR.

  • Pipeline finished with Failed
    3 months ago
    Total: 109s
    #423935
  • Pipeline finished with Failed
    3 months ago
    Total: 134s
    #423936
  • Pipeline finished with Success
    3 months ago
    Total: 383s
    #423949
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    @smustgrave thanks a lot for the review ... all should be addressed. closed the threads

    Anyway I was working to extend the Tests for existing implementation and found some issue that should be fixed now.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    2 small comments I missed first round, that's my fault.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    I don't really see the point of this, what's that action supposed to do exactly? This doesn't "translate", it just copies the existing values into a translation.

    This is something that for example belongs into TMGMT, not core?

  • Pipeline finished with Canceled
    3 months ago
    Total: 89s
    #424929
  • Pipeline finished with Success
    3 months ago
    Total: 406s
    #424930
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    @berdir initially I was using CreateTranslationAction as naming ... maybe it's closer to the "truth"
    But then I thought on other cases/options ... for example "Reset" Translation if exists, ro use the source to override/start over the translation.

    I mentioned in my first comment some "topics", including naming/missing/follow-ups

    For now I updated the title and the summary "terminology" ... not to confuse people, there will be translated content - ready to use/publish.

  • Pipeline finished with Failed
    2 months ago
    Total: 126s
    #429815
  • Pipeline finished with Success
    2 months ago
    Total: 381s
    #429824
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    This is looking good to me.

    When it comes to the discussion of whether something like this is even required, I would add the whole AI context. With such an action plugin, one could prepare a translation of an entity and then pass the untranslated content entity to AI to let it do the translation.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    I'm not convinced that this needs to be in core. I understand the use cases, but this is not extensible. There is no hook here that something could use to intercept the process and actually do something with the translation. You still need to write a custom AI integration to actually do something.

    This also doesn't tie into the content translation permissions and settings, it just checks regular entity update access. Content translation has per-bundle settings to enable/disable translation UI, and it has multiple permissions and its own API to check if a user is allowed to translate into a specific language. It also doesn't tie into the revision API's that were created to deal with content moderation and stuff like this, doesn't check for things like existing drafts and what not.

    The configuration approach means you need to configure this before you can use it and then it's fixed for those specific, and core removed the action UI module from core. So one more reason why you can't use this without additional modules.

    The reference handling is also very opinionated and non-configurable.

    Content Translation has had no official maintainer for 5 years, plenty of issues and adding more features isn't really helping with that. Sorry, but -1 from me. This can live in a contrib module for those that consider it useful.

  • Pipeline finished with Failed
    2 months ago
    Total: 145s
    #430833
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    I can follow the remarks from @berdir, just one fact to add some clarification: core comes with a few other action plugins that have no specific interaction with anything else around. Examples are the send mail action plugin or the display message action plugin. Because of them being still around I'd argue that another one with a specific purpose wouldn't hurt and provide a foundation for others to build upon, even if that happens in contrib space. That could either be the AI ecosystem or even translation management that was mentioned before in #8.

    However, if there is going to be a conclusion that this is not for core, it could easily go into contrib space, like e.g. ECA.

  • Pipeline finished with Failed
    2 months ago
    Total: 147s
    #430837
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    @berdir thanks a lot for your thoughts, but, please, allow me to disagree
    We have in core:
    - Add/Create Translation API - but no Action for it
    - There is hook for this - updated the MR with testing on it.

    This "proposal" is using mostly Core API, except the translation source thing, which seems that needs Content Translation module

    My question
    Do we want "CTools/Entity API" approaches, not to mention things like CCK/Views/i18n and related "era"
    So, imho, the core should provide CORE solutions for its API, not to have, again, extra modules to "complete" a basic Drupal project.

  • Pipeline finished with Success
    2 months ago
    Total: 829s
    #430845
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • Pipeline finished with Success
    about 2 months ago
    Total: 1096s
    #441911
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    solving bot patching issue ... MR updated with latest 11.x

  • πŸ‡¬πŸ‡§United Kingdom catch

    Reading the MR I was thinking along the same lines as #11, let's try to get some more opinions. If this is only useful for the AI suite, it could live there IMO.

  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    This is not only for AI, nor only for ECA, nor only for VBO, nor only with Action UI
    It's just an action/config that could be used for various Multilingual cases using the Core Recipes approach.
    Let's say for Drupal CMS Multilingual CMS.
    Or For a Multilingual recipe, that does not need any of other contrib modules, as maybe there are other specific custom modules to help with this action.
    If we move this to any of AI, ECA, VBO or other ... then the need of such Action/Config will require extra dependencies and this is not specific to these modules.
    For me, it's just Drupal Core ... but maybe I'm too "subjective".

Production build 0.71.5 2024