Problem/Motivation
If a Paragraph library item is translated and we edit the node that contains it in the source language, the summary is in the wrong language.
Proposed resolution
Get the summary in the right language.
Check if this affects only to Library items.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 2940988-5.patch | 1.48 KB | hchonov |
| #4 | 2940988-4.patch | 795 bytes | kala4ek |
Issue fork paragraphs-2940988
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
miro_dietikerFrom my test, the paragraphs library always seem to display its label in the source language, even if we are in a translation context.
This might affect all entity reference labels and it seems to be a Paragraphs issue, not Collection.
Comment #3
berdirYes, it is.
Comment #4
kala4ekNot sure about "library", but that simple patch works well for default entity reference fields.
Seems that it needs to use a current paragraph language (so content language) instead of current interface language.
Comment #5
kala4ekAlso would be good to cover that issue by test.
Comment #6
hchonovWe are observing the issue with the Paragraph's widget when displaying the summary that is generated by the referenced entities. In this case
$this->activeLangcodehas the value ofLanguageInterface::LANGCODE_DEFAULTsince I am not on a translated page, but I am only referencing translated entities in the language of my current page.The solution is that the language ID should be retrieved from the language object.
There are however two places that need to be updated and not just one, which is why I am uploading an updated patch.
Since I am not sure if it is worth it to spend the time on a test for this I would go and set it as RTBC, but the maintainers can decide if they want to delay it on test coverage :).
P.S.
I've also opened an MR.
Comment #8
urvashi_vora commentedHi,
Unfortunately the MR contains no change, moving it to needs work.
Comment #9
urvashi_vora commentedCommitted the changes.
Comment #10
amaisano commentedFYI - this patch does NOT fix the From Library paragraph type label. It continues to be in the content's language (FR), even though we've set our preferences to use EN for all UI.
Add [FR word] is on the dropdown, and the [FR word] is shown to the left of the summary, instead of "From Library" on /fr/node/2/edit with ALL other UI elements being in EN.
All other Paragraph type bundle labels are correctly shown in the UI context of EN, not the node context of FR. The drop down is:
Comment #12
berdirMerged, #10 sounds like a different issue.