* @return Message: $this
*/
public function inLanguage( $lang ) {
- if ( $lang instanceof Language || $lang instanceof StubContLang || $lang instanceof StubUserLang ) {
+ if ( $lang instanceof Language ) {
$this->language = $lang;
} elseif ( is_string( $lang ) ) {
if( $this->language->getCode() != $lang ) {
wfProfileOut( $fname . '-session' );
wfProfileIn( $fname . '-globals' );
-$wgContLang = new StubContLang;
+$wgContLang = Language::factory( $wgLanguageCode );
+$wgContLang->initEncoding();
+$wgContLang->initContLang();
// Now that variant lists may be available...
$wgRequest->interpolateTitle();
/**
* @var Language
*/
-$wgLang = new StubUserLang;
+$wgLang = RequestContext::getMain()->getLang();
/**
* @var OutputPage
/**
* Stub object for the content language of this wiki. This object have to be in
* $wgContLang global.
+ *
+ * @deprecated since 1.18
*/
class StubContLang extends StubObject {
* 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 {
*/
var $transformData = array();
+ /**
+ * @var LocalisationCache
+ */
static public $dataCache;
+
static public $mLangObjCache = array();
static public $mWeekdayMsgs = array(
// $wgContLang = new StubContLang;
$wgUser = new User;
- $wgLang = new StubUserLang;
+ $wgLang = Language::factory( 'en' );
$wgOut = new StubObject( 'wgOut', 'OutputPage' );
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
$wgRequest = new WebRequest;
function tearDown() {
global $wgLanguageCode, $wgContLang, $wgLang;
$wgLanguageCode = $this->languageCode;
- $wgContLang = new StubContLang;
- $wgLang = new StubUserLang;
+ $wgContLang = Language::factory( $wgLanguageCode );
+ $wgLang = RequestContext::getMain()->getLang();
}
/**
function setUp() {
ParserTest::setUp(); //reuse setup from parser tests
- global $wgContLang, $wgUser;
- $wgContLang = new StubContLang;
+ global $wgContLang, $wgUser, $wgLanguageCode;
+ $wgContLang = Language::factory( $wgLanguageCode );
$this->popts = new ParserOptions( $wgUser );
$this->pcache = ParserCache::singleton();
}
// $tmpGlobals['wgContLang'] = new StubContLang;
$tmpGlobals['wgUser'] = new User;
- $tmpGlobals['wgLang'] = new StubUserLang;
+ $tmpGlobals['wgLang'] = Language::factory( 'en' );
$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 = new StubUserLang;
+ $wgLang = Language::factory( 'en' );
$wgOut = new StubObject( 'wgOut', 'OutputPage' );
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
$wgRequest = new WebRequest;