Problem/Motivation

Hi, I am facing similar issue which occurs few years back #2731719: Create translations from the right source
but currently my site is on Drupal 8.8 and Paragraphs 8.x - 1.11

Issue is--
I have a multilingual site. Now let say I am creating a content with EN language and created a FR translation.
Now, if I am going to create another translation DE keeping the Source language as FR.
All the fields in the content is translated correctly with FR text, except Paragraphs field which still picked EN text as source.

The fields in paragraphs are translatable, In content type where field type paragraphs is added, the translatable checkbox is unchecked as there is a message "Paragraphs fields do not support translation. See the online documentation."

Steps to reproduce

  • Create a multilingual site (e.g. EN, FR, DE)
  • Create a node in EN with Paragraphs content
  • Add a translation in FR and translate all fields
  • Add another translation in DE, selecting FR as the source language
  • Observe that:
    • Regular fields use FR as the source
    • Paragraphs fields still use EN as the source

Proposed resolution

Ensure that when a translation is created using a selected source language, Paragraphs fields also use that selected source language instead of defaulting to the original language.

The fields in Paragraphs should load the correct translation for the selected source language.

Remaining tasks

Review and test

User interface changes

None

API changes

None

Data model changes

None

Issue fork paragraphs-3158775

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

Sunil S. created an issue. See original summary.

lamliheussama’s picture

Version: 8.x-1.11 » 8.x-1.12
StatusFileSize
new870 bytes

i have the same bug, after debugging i have find this, before show the create translation form all paragraphs of this node it's translated in the wanted language with value of default language of node, my solution is to delete this translation if translation of node it's load from another source.

lamliheussama’s picture

StatusFileSize
new1.13 KB
christophe.klein’s picture

I had an error message due to unset values while using the patch.

Error: Call to a member function getId() on null in Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget->formElement() (line 441 of /var/www/html/web/modules/contrib/paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php)

Here is the patch updated with a fix for this issue.

stefdewa’s picture

I added an additional check on the paragraphs entity to exclude deletion when it if a default translation. Otherwise I got a

InvalidArgumentException: The specified translation (nl) cannot be removed. in Drupal\Core\Entity\ContentEntityBase->removeTranslation() (line 993 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

baikho made their first commit to this issue’s fork.

baikho’s picture

#5 works fine. Tested on:

  • Drupal Core 11.3.3
  • Paragraphs 8.x-1.20

baikho’s picture

Status: Active » Needs review
baikho’s picture

Issue summary: View changes
baikho’s picture

Fixed formatting in the Issue Summary. Also, this bug appears to only affect moderated content in addition to the steps outlined in the description. (It is unclear whether the OPs content was moderated)

baikho’s picture

Component: User interface » Code
baikho’s picture

Version: 8.x-1.12 » 8.x-1.20