LucasWerkmeister created this task.
LucasWerkmeister added a project: SDC General.
Restricted Application added a subscriber: Aklapper.
Restricted Application added a project: Wikidata.

TASK DESCRIPTION
  I just noticed that the AC/DC gadget 
<https://commons.wikimedia.org/wiki/Special:MyLanguage/Help:Gadget-ACDC> (of 
which I’m the main developer) can’t add monolingual text statements when it’s 
loaded on a category page (but it can add them when loaded on a file page). The 
reason for this seems to be that `MonolingualTextInputWidget` initializes its 
ULS widget with a list of languages from the `wbTermsLanguages` config value:
  
    this.language = new UlsWidget( {
        language: this.state.language,
        languages: mw.config.get( 'wbTermsLanguages' ),
        label: mw.message( 'wikibasemediainfo-monolingualtext-language-label' 
).text()
    } );
  
  But that config value is only provided on file pages:
  
    /**
     * @param \OutputPage $out
     * @param bool $isMediaInfoPage
     * @param string[] $termsLanguages Array with language codes as keys and 
autonyms as values
     * @param UserLanguageLookup $userLanguageLookup
     * @param DispatchingEntityViewFactory $entityViewFactory
     * @param array $jsConfigVars Variables to expose to JavaScript
     * @throws \OOUI\Exception
     */
    public function doBeforePageDisplay(
        $out,
        $isMediaInfoPage,
        array $termsLanguages,
        UserLanguageLookup $userLanguageLookup,
        DispatchingEntityViewFactory $entityViewFactory,
        array $jsConfigVars = []
    ) {
        // Site-wide config
        $modules = [ 'wikibase.mediainfo.search' ];
        $moduleStyles = [];
    
        if ( $isMediaInfoPage ) {
                // ...
                $jsConfigVars = array_merge( $jsConfigVars, [
                        // ...
                        'wbTermsLanguages' => $termsLanguages,
                        // ...
                ] );
                // ...
        }
    
        $out->addJsConfigVars( $jsConfigVars );
        $out->addModuleStyles( $moduleStyles );
        $out->addModules( $modules );
    }
  
  I can work around this in the gadget by setting the `wbTermsLanguages` config 
before loading the WikibaseMediaInfo widgets, getting the list of languages 
from the API, but I’d rather avoid that.

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

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

To: LucasWerkmeister
Cc: Aklapper, LucasWerkmeister, CBogen, darthmon_wmde, Nandana, JKSTNK, Lahi, 
PDrouin-WMF, Gq86, E1presidente, Ramsey-WMF, Cparle, Anooprao, SandraF_WMF, 
GoranSMilovanovic, QZanden, Tramullas, Acer, LawExplorer, Salgo60, Silverfish, 
_jensen, rosalieper, Scott_WUaS, Susannaanas, Jane023, Wikidata-bugs, Base, 
matthiasmullie, aude, Ricordisamoa, Wesalius, Lydia_Pintscher, Fabrice_Florin, 
Raymond, Steinsplitter, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to