Page MenuHomePhabricator

Don’t inject LanguageNameLookup into ViewFactory
Closed, ResolvedPublic

Description

The ViewFactory currently gets a LanguageNameLookup service injected, which already contains the user language, but then ViewFactory::newItemView() and other methods are also called with a $language argument. It doesn’t make sense to have the language at both levels here. (Also, the LanguageNameLookup service itself needs the user language, which we don’t want to use in the service wiring.)

I think the solution will be fairly similar to what @ItamarWMDE did in T281449: create a new LanguageNameLookupFactory service and inject that into ViewFactory. (I’m kind of tempted to skip LanguageNameLookupFactory and just hard-code new LanguageNameLookup( $language->getCode() ) in ViewFactory, but we created factory services for the text provider and number localizer too, so I guess we should have a language name lookup factory as well.)

Event Timeline

Change 684424 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Introduce LanguageNameLookupFactory repo service

https://gerrit.wikimedia.org/r/684424

Change 684425 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Inject LanguageNameLookupFactory into ViewFactory

https://gerrit.wikimedia.org/r/684425

Change 684424 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Introduce LanguageNameLookupFactory repo service

https://gerrit.wikimedia.org/r/684424

Change 684425 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Inject LanguageNameLookupFactory into ViewFactory

https://gerrit.wikimedia.org/r/684425