From 323c74c734abb3e48ffa0d20989b9c9ae9be72eb Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 26 May 2009 07:46:29 +0000 Subject: [PATCH] Reverted r49855, r49656, r49401, r49399, r49397. The language converter cannot be used outside the parser at present without generating a large number of bugs, due to global lifetime state variables, inappropriate $wgParser references, etc. Some refactoring needs to be done before it can be used in this way. --- includes/CategoryPage.php | 2 +- includes/GlobalFunctions.php | 4 +--- languages/Language.php | 6 +++--- languages/LanguageConverter.php | 8 ++------ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index e35a7dec75..c75eb19702 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -189,7 +189,7 @@ class CategoryViewer { */ function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) { global $wgContLang; - $titletext = $wgContLang->convertHtml( $title->getPrefixedText(), true ); + $titletext = $wgContLang->convertHtml( $title->getPrefixedText() ); $this->articles[] = $isRedirect ? '' . $this->getSkin()->makeKnownLinkObj( $title, $titletext ) . '' : $this->getSkin()->makeSizeLinkObj( $pageLength, $title, $titletext ); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index aa44d5e6ad..26b75bf552 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1968,9 +1968,7 @@ function wfGetCachedNotice( $name ) { } wfProfileOut( $fname ); - // Use $wgContLang to get a converted string by language. - global $wgContLang; - return $wgContLang->convert( $notice ); + return $notice; } function wfGetNamespaceNotice() { diff --git a/languages/Language.php b/languages/Language.php index e55771747b..aee11d34fb 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -35,7 +35,7 @@ if( function_exists( 'mb_strtoupper' ) ) { class FakeConverter { var $mLang; function FakeConverter($langobj) {$this->mLang = $langobj;} - function convert($t, $i, $v) {return $t;} + function convert($t, $i) {return $t;} function parserConvert($t, $p) {return $t;} function getVariants() { return array( $this->mLang->getCode() ); } function getPreferredVariant() {return $this->mLang->getCode(); } @@ -2244,8 +2244,8 @@ class Language { } # convert text to different variants of a language. - function convert( $text, $isTitle = false, $variant = null ) { - return $this->mConverter->convert($text, $isTitle, $variant); + function convert( $text, $isTitle = false) { + return $this->mConverter->convert($text, $isTitle); } # Convert text from within Parser diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 13331868e7..86077be7e0 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -505,11 +505,10 @@ class LanguageConverter { * * @param string $text text to be converted * @param bool $isTitle whether this conversion is for the article title - * @param string $variant the variant we convert to * @return string converted text * @public */ - function convert( $text, $isTitle = false, $variant = null ) { + function convert( $text, $isTitle = false ) { $mw =& MagicWord::get( 'notitleconvert' ); if( $mw->matchAndRemove( $text ) ) @@ -524,10 +523,7 @@ class LanguageConverter { if( $mw->matchStart( $text ) ) return $text; - if( $variant && in_array( $variant, $this->mVariants ) ) - $plang = $variant; - else - $plang = $this->getPreferredVariant(); + $plang = $this->getPreferredVariant(); // for title convertion if ( $isTitle ) return $this->convertTitle( $text, $plang ); -- 2.20.1