Problem/Motivation
Forms are still including language.admin.inc to use language_admin_predefined_list()
.
Proposed resolution
Move language_admin_predefined_list()
to ConfigurableLanguageManager
Remaining tasks
Review
User interface changes
None
API changes
Remove language_admin_predefined_list()
and add ConfigurableLanguageManagerInterface::getUnusedPredefinedList()
Comment | File | Size | Author |
---|---|---|---|
#20 | drupal8.language-list-disabled.18.patch | 4.75 KB | sun |
#18 | drupal8.language-list-disabled.18.patch | 4.75 KB | sun |
#16 | drupal8.language-list-disabled.16.patch | 4.73 KB | sun |
#6 | interdiff.txt | 1.31 KB | ParisLiakos |
#6 | 2254495.6.patch | 11.04 KB | ParisLiakos |
Comments
Comment #1
alexpottComment #2
Gábor HojtsyGreat improvement indeed.
Comment #3
penyaskitoWill this order by key? Shouldn't we order by the label?
Maybe it is even out of scope of this issue.
Comment #4
Gábor HojtsyIts not changed in this issue. The native names of the languages may use various character sets, they may be left to right, Chinese, etc. Not sure there could be any sensible order of them if ordered by name/label.
Comment #5
Gábor HojtsyWait, no, its in the interface language. Well, maybe, ordering by their name would be good, but this issue just moves the existing code :) So as far as the scope goes RTBC.
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedi just couldnt let it go :P
Comment #7
Gábor HojtsyCool, looks good still :)
Comment #8
penyaskito+1 RTBC.
Also created #2257199: ConfigurableLanguageManager::getUnusedPredefinedList() should return languages ordered by name instead of language code for discussing comment at #3.
Comment #9
Dries CreditAttribution: Dries commentedNice little clean-up. Committed to 8.x.
Comment #11
Gábor HojtsyYay, thanks!
Comment #12
sunHuh? What's an "unused" predefined list?
Why didn't we simply name that
getPredefinedList()
, which would correspond 1:1 to the @return value description...?EDIT: Also needs a change notice, since API change.
Comment #13
Gábor HojtsyWell, there is indeed some terminology mismatch here. LanguageManager already has a getStandardLanguageList() as used by this method. The method filters that list to the "unused" ones, that is the ones not yet saved as configured languages on the site. That is it returns all the predefined/standard languages that are not used on the site. getStandardLanguageList() already returns the full list. Naming this getPredefinedList() would be pretty confusing since its a filtered list of the languages included with Drupal based on live configuration. Therefore the result itself is not predefined :)
Comment #14
sunSorry, I get it now — the method removes all languages from the predefined list that are enabled already. But hm,
getUnusedPredefinedList()
is a confusing name, because the context of "unused" and its relation to "predefined" is not clear.listPredefinedWithoutEnabled()
?Something along that line would be more clear? Also note list vs. get; all of the get* methods appear to return Language objects, whereas this method simply returns a langcode/label mapping.
Alternatively, we could shoot for a full parity:
getStandardLanguageList() [LanguageManager]
↓
getStandardLanguageListWithoutEnabled() [ConfigurableLanguageManager]
Comment #15
Gábor HojtsyWell, we should indeed ideally match terminology with standard vs. predefined.
Comment #16
sunSo how about this?
Comment #17
Gábor HojtsyLanguages are not enabled in D7 they are added/removed. We just standardised that earlier with #2240463: Fix text: languages are not "enabled/disabled" anymore, they are added/removed. So not sure saying 'enabled' here would be a good idea.
Comment #18
sunSorry, I wasn't aware of that terminology change. Given that,
getStandardLanguageListWithoutConfigured()
would seemingly encompass the technical meaning + take that terminology change into account?Comment #19
Gábor HojtsyLooks good.
Comment #20
sunSorry, missed this instance. s/enabled/configured/
Will cancel previous tests.
Comment #23
catchWould be a lot easier to follow this if the follow-up had been in its own issue. Committed/pushed to 8.x anyway.