Enforce source language set wrong source field in content_translation

Created on 26 April 2023, over 1 year ago

If we use 'Enforce source language' for content (nodes) translation, the saved value of the field 'content_translation_source' in 'node_field_data' get the wrong source language.

We do the following:
We add a node to the 'Cart'. In the Cart, the language of the node shows 'German'. Now we click 'Enforce source language' and select 'English' as source. The english translation exists.
Then we choose in 'Request translation into language' French as target language.

All the following steps (Translation, Review, Save as completed) work well and the french translation is added to the node.

But if we select the 'Translate' tab in the node edit form, 'German' is shown as source language at the french translation.
As mentioned above: The value in content_translation_source = de.

We are using Drupal 9.5.

Don't know, if this is a bug or a feature request or depending on our configuration.

Hope, someone could help.

🐛 Bug report
Status

Active

Version

1.15

Component

Source: Node

Created by

🇩🇪Germany WalterP

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

Comments & Activities

  • Issue created by @WalterP
  • 🇩🇪Germany WalterP

    The following patch solves the problem for us:

    diff --git a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
    index b101d7b2..099d1b78 100644
    --- a/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
    +++ b/sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
    @@ -498,7 +498,7 @@ class ContentEntitySource extends SourcePluginBase implements SourcePreviewInter
         $translation = $entity->getTranslation($target_langcode);
         $manager = \Drupal::service('content_translation.manager');
         if ($manager->isEnabled($translation->getEntityTypeId(), $translation->bundle())) {
    -      $manager->getTranslationMetadata($translation)->setSource($entity->language()->getId());
    +      $manager->getTranslationMetadata($translation)->setSource($item->getJob()->getSourceLangcode());
         }
     
         foreach (Element::children($data) as $field_name) {
    
Production build 0.71.5 2024