diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-01-04 12:24:29 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-01-04 12:24:29 +0100 |
commit | 8f93926e1bc6e96fc11b4d0d201025022d471de7 (patch) | |
tree | 7e13841de0a7d33faf5481d44ca7471ce639193a /languages/LanguageConverter.php | |
parent | fe786bf329367b2d2663ea7f2474ceaeeace6180 (diff) |
update to MediaWiki 1.16.1
Diffstat (limited to 'languages/LanguageConverter.php')
-rw-r--r-- | languages/LanguageConverter.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 75075fee..ebf1ab43 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -20,7 +20,6 @@ class LanguageConverter { var $mVariants, $mVariantFallbacks, $mVariantNames; var $mTablesLoaded = false; var $mTables; - var $mNamespaceTables; // 'bidirectional' 'unidirectional' 'disable' for each variant var $mManualLevel; var $mCacheKey; @@ -87,7 +86,6 @@ class LanguageConverter { } else { $this->mManualLevel[$v] = 'bidirectional'; } - $this->mNamespaceTables[$v] = array(); $this->mFlags[$v] = $v; } } @@ -492,9 +490,14 @@ class LanguageConverter { * @private */ function applyManualConv( $convRule ) { - // use syntax -{T|zh:TitleZh;zh-tw:TitleTw}- for custom - // conversion in title - $this->mConvRuleTitle = $convRule->getTitle(); + // Use syntax -{T|zh-cn:TitleCN; zh-tw:TitleTw}- to custom + // title conversion. + // Bug 24072: mConvRuleTitle won't work if the title conversion + // rule was followed by other manual conversion rule(s). + $newConvRuleTitle = $convRule->getTitle(); + if( $newConvRuleTitle ) { + $this->mConvRuleTitle = $newConvRuleTitle; + } // apply manual conversion table to global table $convTable = $convRule->getConvTable(); @@ -547,12 +550,19 @@ class LanguageConverter { */ public function convertTitle( $title ) { $variant = $this->getPreferredVariant(); - if ( $title->getNamespace() === NS_MAIN ) { + $index = $title->getNamespace(); + if ( $index === NS_MAIN ) { $text = ''; } else { - $text = $title->getNsText(); - if ( isset( $this->mNamespaceTables[$variant][$text] ) ) { - $text = $this->mNamespaceTables[$variant][$text]; + // first let's check if a message has given us a converted name + $nsConvKey = 'conversion-ns' . $index; + if ( !wfEmptyMsg( $nsConvKey ) ) { + $text = wfMsgForContentNoTrans( $nsConvKey ); + } else { + // the message does not exist, try retrieve it from the current + // variant's namespace names. + $langObj = $this->mLangObj->factory( $variant ); + $text = $langObj->getFormattedNsText( $index ); } $text .= ':'; } |