Paragraphs translations are not added for Commerce Products

Created on 29 March 2023, about 1 year ago
Updated 7 April 2023, about 1 year ago

Problem/Motivation

When I use TMGMT tool to translate Commerce Products that contains Paragraphs, everything is translated except Paragraph items. I suppose it's connected to Commerce Product entity because the only difference with Nodes is Products are not revisionable.

Steps to reproduce

1. Install fresh Drupal with TMGMT, Commerce (Commerce Product), Paragraphs modules.
2. Add different Language.
3. Add new Paragraph type with text field, make it translatable.
4. Add Paragraph field to Default commerce product type.
5. Add Product and fill paragraph field.
6. Create Translation Job, then translate each string, including the paragraph field, then review translation.
7. Go to the translated product page and see that it has original paragraph text and it wasn't translated.

If you go to the DB, you'll see that translation for this field wasn't created also although if you try to translate it manually through Translation tab, everything will be translated correctly.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Core

Created by

πŸ‡ΊπŸ‡¦Ukraine lobodacyril

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

Comments & Activities

  • Issue created by @lobodacyril
  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine lobodacyril

    I've noticed that TMGMT supports nested revisionable reference fields by this code:

    $target_save = FALSE;
    $target_entity->needsSave();
    

    So it has to be postpone saving but since $target_entity->needsSave(); doesn't set needsSave property and just return in, it doesn't work. So the code should be the next:

    $target_save = FALSE;
    $target_entity->setNeedsSave(TRUE);
    

    I'm not sure why it works for Nodes but this change works for Products and for Nodes.

  • πŸ‡¬πŸ‡·Greece DiyanDev

    Had excactly the same issue, the patch indeed seems to be working.
    The preview feature is still not translating paragraphs tho.

Production build 0.69.0 2024