Paragraphs translations are not added for Commerce Products

Created on 29 March 2023, over 1 year ago
Updated 3 September 2024, 2 months 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

Closed: duplicate

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

  • Status changed to RTBC 4 months ago
  • πŸ‡©πŸ‡ͺGermany a.dmitriiev

    I have the same issue even with nodes and paragraphs. I have also found the same solution as in MR and patch. I confirm that with setNeedsSave(TRUE) change, that really sets the value instead of `needsSave();` that only returns the value, everything works fine.

    Setting the issue status to "reviewed & tested".

  • Status changed to Closed: duplicate 2 months ago
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Committed patch from πŸ› Paragraphs translations aren't always updated Fixed

Production build 0.71.5 2024