Lucas_Werkmeister_WMDE added a comment.
As far as I’m aware, the two main sources of the user language (assuming you don’t have access to an `IContextSource` where you can call `getLanguage()`) are `global $wgLang` and `RequestContext::getMain()->getLanguage()`. (Which ultimately amounts to the same thing – see `StubUserLang::_newObject()`.) CirrusSearch’s SearchConfig.php <https://gerrit.wikimedia.org/g/mediawiki/extensions/CirrusSearch/+/03d398af8eab8e2f2a644b8dfeb3229e3ad4dc2a/includes/SearchConfig.php#223> puts it like this: /** * Get user's language * @return string User's language code */ public function getUserLanguage() { // I suppose using $wgLang would've been more evil than this, but // only marginally so. Find some real context to use here. return RequestContext::getMain()->getLanguage()->getCode(); } For our service wiring, I suggest we use `$wgLang`, which should be easier to mock in the unit test for this service wiring. TASK DETAIL https://phabricator.wikimedia.org/T278819 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Lucas_Werkmeister_WMDE Cc: Lucas_Werkmeister_WMDE, Aklapper, Invadibot, maantietaja, Akuckartz, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude, Mbch331
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
