diff options
Diffstat (limited to 'languages')
-rw-r--r-- | languages/LanguageConverter.php | 28 | ||||
-rw-r--r-- | languages/classes/LanguageGan.php | 41 | ||||
-rw-r--r-- | languages/classes/LanguageZh.php | 47 | ||||
-rw-r--r-- | languages/messages/MessagesFr.php | 2 |
4 files changed, 20 insertions, 98 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 .= ':'; } diff --git a/languages/classes/LanguageGan.php b/languages/classes/LanguageGan.php index 3c8b5fdb..54202e48 100644 --- a/languages/classes/LanguageGan.php +++ b/languages/classes/LanguageGan.php @@ -26,47 +26,6 @@ class GanConverter extends LanguageConverter { 'gan-hant' => '繁體', ); $this->mVariantNames = array_merge($this->mVariantNames,$names); - $this->loadNamespaceTables(); - } - - function loadNamespaceTables() { - global $wgMetaNamespace; - $nsproject = $wgMetaNamespace; - $projecttable = array( - 'Wikipedia' => '维基百科', - 'Wikisource' => '维基文库', - 'Wikinews' => '维基新闻', - 'Wiktionary' => '维基词典', - 'Wikibooks' => '维基教科书', - 'Wikiquote' => '维基语录', - ); - $this->mNamespaceTables['gan-hans'] = array( - 'Media' => '媒体', - 'Special' => '特殊', - 'Talk' => '談詑', - 'User' => '用户', - 'User talk' => '用户談詑', - $nsproject - => isset($projecttable[$nsproject]) ? - $projecttable[$nsproject] : $nsproject, - $nsproject . ' talk' - => isset($projecttable[$nsproject]) ? - $projecttable[$nsproject] . '談詑' : $nsproject . '談詑', - 'File' => '文件', - 'File talk' => '文件談詑', - 'MediaWiki' => 'MediaWiki', - 'MediaWiki talk' => 'MediaWiki談詑', - 'Template' => '模板', - 'Template talk' => '模板談詑', - 'Help' => '帮助', - 'Help talk' => '帮助談詑', - 'Category' => '分类', - 'Category talk' => '分类談詑', - ); - $this->mNamespaceTables['gan-hant'] = array_merge($this->mNamespaceTables['gan-hans']); - $this->mNamespaceTables['gan-hant']['File'] = '檔案'; - $this->mNamespaceTables['gan-hant']['File talk'] = '檔案談詑'; - $this->mNamespaceTables['gan'] = array_merge($this->mNamespaceTables['gan-hans']); } function loadDefaultTables() { diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index 4a73c665..0b88dbb2 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -32,53 +32,6 @@ class ZhConverter extends LanguageConverter { 'zh-my' => '大马', ); $this->mVariantNames = array_merge($this->mVariantNames,$names); - $this->loadNamespaceTables(); - } - - function loadNamespaceTables() { - global $wgMetaNamespace; - $nsproject = $wgMetaNamespace; - $projecttable = array( - 'Wikipedia' => '维基百科', - 'Wikisource' => '维基文库', - 'Wikinews' => '维基新闻', - 'Wiktionary' => '维基词典', - 'Wikibooks' => '维基教科书', - 'Wikiquote' => '维基语录', - ); - $this->mNamespaceTables['zh-hans'] = array( - 'Media' => '媒体', - 'Special' => '特殊', - 'Talk' => '讨论', - 'User' => '用户', - 'User talk' => '用户讨论', - $nsproject - => isset($projecttable[$nsproject]) ? - $projecttable[$nsproject] : $nsproject, - $nsproject . ' talk' - => isset($projecttable[$nsproject]) ? - $projecttable[$nsproject] . '讨论' : $nsproject . '讨论', - 'File' => '文件', - 'File talk' => '文件讨论', - 'MediaWiki' => 'MediaWiki', - 'MediaWiki talk' => 'MediaWiki讨论', - 'Template' => '模板', - 'Template talk' => '模板讨论', - 'Help' => '帮助', - 'Help talk' => '帮助讨论', - 'Category' => '分类', - 'Category talk' => '分类讨论', - ); - $this->mNamespaceTables['zh-hant'] = array_merge($this->mNamespaceTables['zh-hans']); - $this->mNamespaceTables['zh-hant']['File'] = '檔案'; - $this->mNamespaceTables['zh-hant']['File talk'] = '檔案討論'; - $this->mNamespaceTables['zh'] = array_merge($this->mNamespaceTables['zh-hans']); - $this->mNamespaceTables['zh-cn'] = array_merge($this->mNamespaceTables['zh-hans']); - $this->mNamespaceTables['zh-hk'] = array_merge($this->mNamespaceTables['zh-hant']); - $this->mNamespaceTables['zh-mo'] = array_merge($this->mNamespaceTables['zh-hant']); - $this->mNamespaceTables['zh-my'] = array_merge($this->mNamespaceTables['zh-hans']); - $this->mNamespaceTables['zh-sg'] = array_merge($this->mNamespaceTables['zh-hans']); - $this->mNamespaceTables['zh-tw'] = array_merge($this->mNamespaceTables['zh-hant']); } function loadDefaultTables() { diff --git a/languages/messages/MessagesFr.php b/languages/messages/MessagesFr.php index 3479c1a7..c0cd327a 100644 --- a/languages/messages/MessagesFr.php +++ b/languages/messages/MessagesFr.php @@ -254,7 +254,7 @@ $specialPageAliases = array( 'Preferences' => array( 'Préférences' ), 'Watchlist' => array( 'Liste de suivi', 'ListeDeSuivi', 'Suivi' ), 'Recentchanges' => array( 'Modifications récentes', 'Modifications recentes', 'ModificationsRécentes', 'ModificationsRecentes' ), - 'Upload' => array( 'Téléverser', 'Televerser', 'Téléversement', 'Televersement' ), + 'Upload' => array( 'Téléverser', 'Televerser', 'Téléversement', 'Televersement', 'Téléchargement', 'Telechargement' ), 'Listfiles' => array( 'Liste des fichiers', 'ListeDesFichiers', 'Liste des images', 'ListeDesImages' ), 'Newimages' => array( 'Nouveaux fichiers', 'NouveauxFichiers', 'Nouvelles images', 'NouvellesImages' ), 'Listusers' => array( 'Liste des utilisateurs', 'ListeDesUtilisateurs', 'Utilisateurs' ), |