Integration with paragraphs asymmetric translation

Created on 8 May 2020, about 4 years ago
Updated 28 May 2024, 19 days ago

Problem/Motivation

Under the hood, where Paragraphs asymmetric translation widgets creates 1 paragraph target id by translation for the host entity, a job creates 1 for the source and the translation.

Example: given an article node that has a field_content paragraph, in the database we have
- For the EN > DE translation done via tmgmt, the same field_content_target_id
- For the EN > FR translation done manually via the node edit form, another field_content_target_id

Then, while editing the DE node, if the patch from #3035916: Translation Problem with Paragraph 1.6 and Paragraphs asymmetric translation widgets 1.0-beta1 β†’ is not applied, the edit form is showing the EN source while the frontend is showing the DE translation.

Proposed resolution

Allow to hook into the ContentEntitySource::doSaveTranslation() or implement support for Paragraphs asymmetric translation widgets in ContentEntitySource to keep the same behaviour as the entity edit form.

Perhaps make use of createDuplicateWithSingleLanguage() from https://git.drupalcode.org/project/paragraphs_asymmetric_translation_wid... once the host entity configuration for this paragraph field is set to use asymmetrical translations.

✨ Feature request
Status

Needs work

Version

1.0

Component

Miscellaneous

Created by

πŸ‡§πŸ‡ͺBelgium colorfield Brussels

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • πŸ‡§πŸ‡ͺBelgium tijsdeboeck Antwerp πŸ‡§πŸ‡ͺ πŸ‡ͺπŸ‡Ί 🌎

    We've used patch #33 to fix asymmetric translations, works perfectly!

  • πŸ‡ΊπŸ‡ΈUnited States amaisano Boston

    I am using D10, Paragraphs 1.16, TMGMT, and cannot get the accepted job translations for paragraph fields into the node translation when it gets created. Or even on updates.

    I've enabled translation on the node's "field_paragraphs" field, AND all the fields for my paragraph types.

    I'm using non-patched paragraphs_asymmetric_translation_widgets module, and this patch.

    I've also tried patch 122 and 128 on the original Paragraphs Experimental issue for asymmetry, same results.

    Is there another step I could be missing? Does this not work with D10? All of the patches applied cleanly.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 8
    last update 8 months ago
    103 pass, 10 fail
  • πŸ‡©πŸ‡°Denmark Birk

    The patch from #33 ✨ Integration with paragraphs asymmetric translation RTBC almost did it for me.
    But if the target translation had less paragraphs than the source, the extra paragraphs wasn't added.

    I've moved around on some parentheses, so the condition is (OR):

    • $referenced_entity->id() == $field_item[$property]['#id'] Same entity
    • ($item_delta === $delta && !$is_target_type_translatable) Same delta, and not translatable
    • $is_asymmetric_translation_mode Is asymmetric paragraph
  • Status changed to Needs work 8 months ago
  • πŸ‡©πŸ‡°Denmark Birk

    This is the correct patch.

  • πŸ‡©πŸ‡°Denmark Birk

    After I've been working more with the tmgmt module, I realized my previous assumption about the conditions in findReferenceEntity() was wrong (and introduced an error where the first paragraph was chosen for cloning each time).
    Sorry if this has caused any confusion!

    Anyway, I think the problem (in my use case) is the $entity passed to the doSaveTranslations() function, is not using the jobs source language.

    I've supplied a patch that sets the entity language in the saveTranslation() function.

  • πŸ‡§πŸ‡·Brazil adinancenci

    If a corresponding paragraph does not exist in the targeted translation, the strings submitted in the tmgmt form will be lost upon completion.

    I modified the patch #39 by @birk to create a paragraph.

    I hope what I made here makes sense.

Production build 0.69.0 2024