* @return Message: $this
*/
public function inLanguage( $lang ) {
- if ( $lang instanceof Language ) {
+ if ( $lang instanceof Language || $lang instanceof StubUserLang ) {
$this->language = $lang;
} elseif ( is_string( $lang ) ) {
if( $this->language->getCode() != $lang ) {
/**
* @var Language
*/
-$wgLang = RequestContext::getMain()->getLang();
+$wgLang = new StubUserLang;
/**
* @var OutputPage
* Stub object for the user language. It depends of the user preferences and
* "uselang" parameter that can be passed to index.php. This object have to be
* in $wgLang global.
- *
- * @deprecated since 1.18
*/
class StubUserLang extends StubObject {
// $wgContLang = new StubContLang;
$wgUser = new User;
- $wgLang = Language::factory( 'en' );
+ $wgLang = new StubUserLang;
$wgOut = new StubObject( 'wgOut', 'OutputPage' );
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
$wgRequest = new WebRequest;
global $wgLanguageCode, $wgContLang, $wgLang;
$wgLanguageCode = $this->languageCode;
$wgContLang = Language::factory( $wgLanguageCode );
- $wgLang = RequestContext::getMain()->getLang();
+ $wgLang = new StubUserLang;
}
/**
// $tmpGlobals['wgContLang'] = new StubContLang;
$tmpGlobals['wgUser'] = new User;
- $tmpGlobals['wgLang'] = Language::factory( 'en' );
+ $tmpGlobals['wgLang'] = new StubUserLang;
$tmpGlobals['wgOut'] = new StubObject( 'wgOut', 'OutputPage' );
$tmpGlobals['wgParser'] = new StubObject( 'wgParser', $GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) );
$tmpGlobals['wgRequest'] = new WebRequest;
// $wgContLang = new StubContLang;
$wgUser = new User;
- $wgLang = Language::factory( 'en' );
+ $wgLang = new StubUserLang;
$wgOut = new StubObject( 'wgOut', 'OutputPage' );
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
$wgRequest = new WebRequest;