Problem/Motivation

It seems there is no Action plugin to create content translations.
There could be plenty of uses cases, where such Action is needed.
- Just testing multilingual for existing not-translated 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 create content translations with an action"

Proposed resolution

Within Content Translation module
- Translatable Action Deriver
- Configurable Action Plugin for Creating Content Translations
-- 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

- Create/Add Content Translation 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

--

CommentFileSizeAuthor
#14 3506152-nr-bot.txt91 bytesneeds-review-queue-bot

Issue fork drupal-3506152

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vasike created an issue. See original summary.

vasike’s picture

Status: Active » Needs review

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.

vasike’s picture

(Kernel) Tests added

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Nice!

left some comments on the MR.

vasike’s picture

Status: Needs work » Needs review

@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.

smustgrave’s picture

Status: Needs review » Needs work

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

berdir’s picture

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?

vasike’s picture

Title: Translate Action for Content Translation module » Add/Create Translation Action for Content Translation module
Issue summary: View changes
Status: Needs work » Needs review

@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.

jurgenhaas’s picture

Status: Needs review » Reviewed & tested by the community

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.

berdir’s picture

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.

jurgenhaas’s picture

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.

vasike’s picture

@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.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

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.

vasike’s picture

Status: Needs work » Reviewed & tested by the community

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

catch’s picture

Status: Reviewed & tested by the community » Needs review

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.

vasike’s picture

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".

penyaskito’s picture

-1

This would create e.g. a German translation with the English content. How would a user track that they need to update the contents?
If they need to go to every translation and edit it, what's the purpose of this? Also, a "non-German" revision in German would exist even after editing it.

gábor hojtsy’s picture

I agree with @berdir and @penyaskito this does not actually create a translation, it is probably best to live in contrib.

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)

@vasike do you want to move to TMGMT or start a new module?

Am saving credit for the work done and feedback

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

There hasn't been a follow up but this has gotten -1 from 2 of the translation maintainers recommending this live in contrib.

Thanks everyone!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.