Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikibase Service Migration, wdwb-tech, 
Wikidata.

TASK DESCRIPTION
  Currently, we inject the `LanguageNameLookup` service into the 
`WikibaseValueFormatterBuilders` class 
(`WikibaseRepo.DefaultValueFormatterBuilders` service). Since that service is 
deprecated, we should avoid that.
  
  I think one option would be to use the `LanguageNameLookupFactory` service 
introduced in T281712 <https://phabricator.wikimedia.org/T281712>. Most (all?) 
of the `WikibaseValueFormatterBuilders` methods take a `FormatterOptions` 
argument, which should(?) contain a language option 
(`ValueFormatter::OPT_LANG`); if we inject a language name lookup //factory// 
into the formatter builders, then each time we actually build a specific 
formatter from a set of options, we can use that factory to create a specific 
language name lookup.
  
  That said, I’m not sure that the options actually contain a language each 
time. I suggest something like this (sketch code):
  
    private function getLanguageNameLookup( FormatterOptions $options ) {
        if ( $options->hasOption( ValueFormatters::OPT_LANG ) ) {
                return $this->languageNameLookupFactory->getForLanguageCode( 
$options->getOption( ValueFormatters::OPT_LANG ) );
        } else {
                // TODO wfDeprecated() probably?
                return $this->languageNameLookupFactory->getForLanguage( 
WikibaseRepo::getUserLanguage() );
        }
    }

TASK DETAIL
  https://phabricator.wikimedia.org/T281726

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Lucas_Werkmeister_WMDE, Invadibot, maantietaja, Akuckartz, 
Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, 
rosalieper, Scott_WUaS, Wikidata-bugs, aude, Addshore, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to