From: Alexandre Emsenhuber Date: Tue, 16 Dec 2008 17:21:42 +0000 (+0000) Subject: Use wfGetLangObj() X-Git-Tag: 1.31.0-rc.0~43933 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=70821d4e128ad9fe2584faa2c0b80eb61b399e3c;p=lhc%2Fweb%2Fwiklou.git Use wfGetLangObj() --- diff --git a/includes/EditPage.php b/includes/EditPage.php index ea4c056e27..3852f17be8 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1632,7 +1632,7 @@ END * @return string */ function getPreviewText() { - global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang; + global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache; wfProfileIn( __METHOD__ ); @@ -1684,19 +1684,9 @@ END // Parse mediawiki messages with correct target language if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { - $pos = strrpos( $this->mTitle->getText(), '/' ); - if ( $pos !== false ) { - $code = substr( $this->mTitle->getText(), $pos+1 ); - switch ($code) { - case $wgLang->getCode(): - $obj = $wgLang; break; - case $wgContLang->getCode(): - $obj = $wgContLang; break; - default: - $obj = Language::factory( $code ); - } - $parserOptions->setTargetLanguage( $obj ); - } + list( /* $unused */, $lang ) = $wgMessageCache->figureMessage( $this->mTitle->getText() ); + $obj = wfGetLangObj( $lang ); + $parserOptions->setTargetLanguage( $obj ); }