if ( !$this->language instanceof Language || $this->language->getCode() != $lang ) {
$this->language = Language::factory( $lang );
}
+ } elseif ( $lang instanceof StubUserLang ) {
+ $this->language = false;
} else {
$type = gettype( $lang );
throw new MWException( __METHOD__ . " must be "
/**
* @var Language $wgLang
*/
-$wgLang = RequestContext::getMain()->getLanguage(); // BackCompat
+$wgLang = new StubUserLang;
/**
* @var OutputPage $wgOut
* @return Language
*/
protected function languageFromParam( $lang ) {
+ global $wgLang;
+
if ( $lang === null ) {
- return RequestContext::getMain()->getLanguage();
- } elseif ( $lang instanceof Language ) {
+ // @todo: Use RequestContext::getMain()->getLanguage() instead
+ return $wgLang;
+ } elseif ( $lang instanceof Language || $lang instanceof StubUserLang ) {
return $lang;
} else {
return Language::factory( $lang );
*
* @param int|float $num
* @param string $raw
- * @param Language $language
+ * @param Language|StubUserLang $language
* @return string
*/
public static function formatRaw( $num, $raw, $language ) {