From 522608515402a1784123254ee655eec0848cf67d Mon Sep 17 00:00:00 2001
From: Philip Tzou
Date: Tue, 6 Jul 2010 03:06:31 +0000
Subject: [PATCH] Bug 24072: The manual conversion of title was taken
interferes by other manual conversion rule(s). This patch fixed the problem
and add a new test to parserTests.txt to prevent it to reappear again.
---
languages/LanguageConverter.php | 11 ++++++++---
maintenance/parserTests.txt | 14 ++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php
index c9835837a5..f0a4f460b2 100644
--- a/languages/LanguageConverter.php
+++ b/languages/LanguageConverter.php
@@ -488,9 +488,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();
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 908f466df3..617ad8be5b 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -7242,6 +7242,20 @@ China
!! end
+!! test
+Bug 24072: more test on conversion rule for title
+!! options
+language=zh variant=zh-tw showtitle
+!! input
+This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
+This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
+!! result
+Taiwan
+This should be stripped!
+This won't take interferes with the title rule.
+
+!! end
+
!! test
Raw output of variant escape tags (R flag)
!! options
--
2.20.1