r44677 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44676‎ | r44677 | r44678 >
Date:17:21, 16 December 2008
Author:ialex
Status:ok
Tags:
Comment:
Use wfGetLangObj()
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -1632,7 +1632,7 @@
16331633 * @return string
16341634 */
16351635 function getPreviewText() {
1636 - global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang;
 1636+ global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache;
16371637
16381638 wfProfileIn( __METHOD__ );
16391639
@@ -1684,19 +1684,9 @@
16851685
16861686 // Parse mediawiki messages with correct target language
16871687 if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
1688 - $pos = strrpos( $this->mTitle->getText(), '/' );
1689 - if ( $pos !== false ) {
1690 - $code = substr( $this->mTitle->getText(), $pos+1 );
1691 - switch ($code) {
1692 - case $wgLang->getCode():
1693 - $obj = $wgLang; break;
1694 - case $wgContLang->getCode():
1695 - $obj = $wgContLang; break;
1696 - default:
1697 - $obj = Language::factory( $code );
1698 - }
1699 - $parserOptions->setTargetLanguage( $obj );
1700 - }
 1688+ list( /* $unused */, $lang ) = $wgMessageCache->figureMessage( $this->mTitle->getText() );
 1689+ $obj = wfGetLangObj( $lang );
 1690+ $parserOptions->setTargetLanguage( $obj );
17011691 }
17021692
17031693

Status & tagging log