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
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
Comment #2
lamliheussama commentedi 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.
Comment #3
lamliheussama commentedComment #4
christophe.klein commentedI 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.
Comment #5
stefdewa commentedI 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).Comment #7
baikho commented#5 works fine. Tested on:
Comment #9
baikho commentedComment #10
baikho commentedComment #11
baikho commentedFixed 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)
Comment #12
baikho commentedComment #13
baikho commented