Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Oct 2015 at 09:30 UTC
Updated:
9 Nov 2015 at 09:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
s_leu commentedHere's first patch that determines whether the entity's type is translatable and sets the corresponding argument for $formatter->view().
Comment #4
s_leu commentedNew patch after discussing this with Berdir.
Comment #5
berdirComment #6
gábor hojtsyComment #7
yched commentedYeah, actually this is not the language for the field values (since the entity is not translatable, the values don't depend on language), but the language that the formatter should use for "what it does with the field values".
This area is a bit confusing, and we've been adjusting it back and forth a couple times, so IMO this deserves some explicit comment here.
Here's what I can come up with atm:
"The language of the field values to display is already determined in the incoming $entity. The formatter should build its output of those values using:
- the entity language if the entity is translatable,
- the current "content language" otherwise."
Suggestions / refinements welcome :-)
Nitpick, but I'd find a ternary, or if too long an explicit if/else, to be clearer.
Also, what if *not* instanceof TranslatableInterface ? we keep the entity langcode as if the entity was translatable ? seems weird ?
Shouldn't it be :
?
Comment #8
plachAside from the fact that this should not be very common, I think it would probably make sense not provide a language also in this case. The entity language can be retrieved from the items if needed.
Comment #9
yched commented@plach : meaning, you're +1 on the proposal at the end of #7 ? (just making sure ;-)
Comment #10
mbovan commentedAddressed the feedback from #7. Tests still needed.
Comment #11
plachYep, that was a verbose +1 :)
Comment #12
mbovan commentedAdded tests.
Comment #14
amateescu commentedI also encountered this problem while working on #2144377: Entity reference autocomplete lists entity labels only in current content language, and the fix looks good, as agreed upon in #9/#11.
Comment #15
berdirGreat to see this RTBC.
Tagging with rc target triage. It's not a huge problem, but we did run into both this and #2144377: Entity reference autocomplete lists entity labels only in current content language in our very first multilingual D8 project and I think many other sites will too if you e.g. use term references on users.
It's a small change in the behavior, but I don't think anyone expects the current behavior and we have agreement from @yched, @plach, @amateescu and @GaborHoitsy also agreed in IRC.
Comment #18
xjmDiscussed with the D8 committers and we agreed with making this an rc target.
Comment #19
catchCommitted/pushed to 8.0.x, thanks!
Comment #21
gábor hojtsyYay, thanks!