Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Nov 2017 at 01:46 UTC
Updated:
2 Oct 2018 at 14:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
miro_dietikerI accidentally duplicated this issue, thus promoting with a comment. :-)
Comment #3
merilainen commentedI think the problem lies in the getNestedSummary() where the referenced entity is fetched but there is nothing language specific.
In my case I do see paragraph values in correct language, but if that paragraph has nested paragraphs, they appear in the summary in the original (source) language.
Here is a patch which seems to fix it.
Comment #4
johnchqueWhile testing this I realized that this might work better when there are multiple translation of the node. I will work on the tests tomorrow.
@mErilainen thanks for your patch! :)
Comment #6
merilainen commentedTo me it seems that the last patch is trying to fetch the nested paragraph in the parent paragraph's source language, which would not be the translation being edited. And it doesn't work either, see the attached screenshot.
Comment #7
johnchqueOhhh I see, then I found a different problem. When we have more than one translation for the node. And we select the source language that we want to translate, when we switch the language, the summary always displays the original language.
Will open an issue for that.
I could replicate what you mean, think your first patch made sense then, working on tests now. :)
Comment #8
merilainen commentedSo should I add my first patch back here to get it tested?
Comment #9
johnchqueThere we go with tests. :) This should avoid regressions later. :)
Comment #10
johnchqueThis is the other bug I found #2997565: Summary does not follow the source language.
Comment #12
berdirLets also do that for the referenced entities and their label.
Thought about using \Drupal\Core\Entity\EntityRepositoryInterface::getTranslationFromContext(), but I don't think we care about the fallback here. It would save the hasTranslation check though.
Comment #13
johnchqueTrue, referenced entities had the same problem. This should fix it. :)
Comment #15
berdirentityManager() is deprecated, we shouldn't add new usages of that. The problem is that this method moved to a different service, so you can't use entityTypeManager() but have to call out to \Drupal::service()
Comment #16
megadesk3000 commentedI am starting to work on this on #drupaleurope
Comment #17
megadesk3000 commentedChanged code to use Drupal::service() instead of entityManager()
Comment #18
megadesk3000 commentedComment #19
johnchqueLet's also change here. :)
Comment #20
megadesk3000 commentedChanged the other entityManager() occurence as well.
Comment #21
megadesk3000 commentedComment #22
berdirThat's still the wrong service though, you still use the deprecated entity manager.
The service you need to use is entity.repository.
Comment #23
megadesk3000 commentedHi @Berdir
You are totally right. Missed that point and fixed it now.
Comment #24
megadesk3000 commentedComment #25
berdirThanks.
Comment #27
miro_dietikerThank you, committed this!