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

CommentFileSizeAuthor
#6 2940988-5.patch1.48 KBhchonov
#4 2940988-4.patch795 byteskala4ek

Issue fork paragraphs-2940988

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

yongt9412 created an issue. See original summary.

miro_dietiker’s picture

Title: Get summary in the right language » Entity reference library label not displayed in translation language
Category: Task » Bug report

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

berdir’s picture

Project: Paragraphs Collection » Paragraphs
Component: Library » Code

Yes, it is.

kala4ek’s picture

Status: Active » Needs review
StatusFileSize
new795 bytes

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

kala4ek’s picture

Status: Needs review » Active
Issue tags: +Needs tests

Also would be good to cover that issue by test.

hchonov’s picture

Title: Entity reference library label not displayed in translation language » Paragraph's summary is not using the translated referenced entity for the summary
Status: Active » Reviewed & tested by the community
StatusFileSize
new1.48 KB

We are observing the issue with the Paragraph's widget when displaying the summary that is generated by the referenced entities. In this case $this->activeLangcode has the value of LanguageInterface::LANGCODE_DEFAULT since 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.

urvashi_vora’s picture

Status: Reviewed & tested by the community » Needs work

Hi,

Unfortunately the MR contains no change, moving it to needs work.

urvashi_vora’s picture

Status: Needs work » Needs review

Committed the changes.

amaisano’s picture

FYI - 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:

Add Depuis la bibliothèqe to Paragraphs field
- Custom Text
- Chart
- Etc. (EN)

  • Berdir committed 06eff5fa on 8.x-1.x authored by hchonov
    Issue #2940988 by hchonov, kala4ek, urvashi_vora: Paragraph's summary is...
berdir’s picture

Status: Needs review » Fixed

Merged, #10 sounds like a different issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.