Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
language.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2014 at 05:38 UTC
Updated:
13 Jul 2021 at 14:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yesct commentedSo we can see what we are talking about.
Comment #2
yesct commented#2228129: Unnecessary separate config load call to load languages
changed this code but didn't update the comment.
but we dont want to get it from config anyway.
we should try and use the entity system.
let's see if this passes. (it might not work if this is called before we have a database)
foreach (\Drupal::entityManager()->getStorage('language_entity')->loadMultiple() as $language ) {--
if this works, we can inject the entityManager later.
---------------------------
open an separate issue for:
that logic should just be in a method like getDataObject(). then we could just:
$this->languages[$langcode] = $language->getDataObject();Comment #4
dawehnerThat is kind of odd, shouldn't we just use $language->id() here? On top the obvious dependency injection stuff.
Comment #5
plachWe cannot use the entity manager in the language manager as the the former depends on the latter (we would introduce a circular dependency). This is the reason why we are accessing config storage directly atm. If I am missing something please let's get a real issue summary before going on with coding :)
Comment #6
yesct commentedshould the LanguageInterface when language module is installed be called ConfigurableLanguageInterface (note that that language manager is called ConfigurableLanguageManager).
------
thought about doing this:
=================
uploading these just to see what tests break and thought seeing it in code might help clarify thoughts on things.
=================
------
6
better type hint (should be no test fails)
changes type hint to indicate what it is an array of
-------
6b
there are two classes named LanguageInterface.
one is for the Core (language unaware language interface), one is for when language module is installed and language is a config entity.
name the language interface similar to the way that language manager is in the first case LanguageManager and in the second ConfigurableLanguageManager.
------
6c
options was really property values.
and name was not the label/name but the key (name)
Comment #9
tstoecklerHere's a patch that rolls all those patches above into one. Patch 6b failed because Language module's
Languageclass was missing the required methods to actually implementLanguageInterface. Added those.I only saw - after rolling the patch - that the patch 6c above renames Core's
Languageclass'nametolabel. I instead renamed Language module'sLanguageclass'labeltoname. Sorry, didn't mean to overrule you.I do think however, that name is a more appropriate key name - in general - for config entities but I don't feel strongly. I.e. I'm fine with reversing the rename.
Comment #10
plachCan we please have an issue summary? I am still not getting what's wrong here (see #5).
Comment #11
plachComment #13
tim.plunkettThis is a good change, but seems out of scope.
It's not okay to duplicate id() and label(), they are sufficient.
Comment #14
tstoecklerThanks for the review!
Re #1: That is in scope as long as we want to tackle the name -> label rename here. If you revert this the language list will fatal.
Re #2: I totally agree, but we have those methods on LanguageInterface, so don't really know what to do.
Comment #15
yesct commented@plach yep. I'm on it. making actual separate issues with specific titles and summaries.
Comment #16
yesct commenteddone opening sub issues.
put the list in the summary.
Comment #25
catch#2246721: Language class should use property 'label' to be consistent with entities is the only sub-issue remaining, so closing this as fixed, and the last one can happen when it happens.