From: Zheng Zhu Date: Sun, 19 Sep 2004 03:53:06 +0000 (+0000) Subject: Caching the conversion tables, just like the caching of the UTF-8 case conversion... X-Git-Tag: 1.5.0alpha1~1960 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=ebc0999e7c13ec1ae6f6d69dee9cc7582c5cfbe1;p=lhc%2Fweb%2Fwiklou.git Caching the conversion tables, just like the caching of the UTF-8 case conversion tables. --- diff --git a/includes/ZhConversion.php b/includes/ZhConversion.php index 6fca80f0c3..6a16fc2aa9 100644 --- a/includes/ZhConversion.php +++ b/includes/ZhConversion.php @@ -17,7 +17,7 @@ phrases are limited to below 5 characters. */ -$wgZhSimp2Trad=array( +$zhSimp2Trad=array( "万"=>"萬", "与"=>"與", "丑"=>"醜", @@ -5028,6 +5028,7 @@ $wgZhSimp2Trad=array( "庞克" => "龐克", "龟壳" => "龜殼", "当" => "當", + "一国两制" => "一國兩制", "一拍即合" => "一拍即合", "一板一眼" => "一板一眼", @@ -5465,7 +5466,7 @@ $wgZhSimp2Trad=array( "麦当奴道" => "麥當奴道", ); -$wgZhTrad2Simp=array( +$zhTrad2Simp=array( "么"=>"么", "瀋"=>"沈", "畫"=>"划", @@ -8328,6 +8329,7 @@ $wgZhTrad2Simp=array( "鍛鍾" => "锻锺", "雕畫" => "雕画", "鯰魚" => "鲶鱼", + "三聯畫" => "三联画", "人物畫" => "人物画", "餘光中" => "余光中", @@ -8380,6 +8382,7 @@ $wgZhTrad2Simp=array( "靜物畫" => "静物画", "風景畫" => "风景画", "麻黃鹼" => "麻黄碱", + "一筆一畫" => "一笔一画", "亂塗亂畫" => "乱涂乱画", "餘事後敘" => "余事后叙", diff --git a/languages/LanguageZh.php b/languages/LanguageZh.php index 3f3228fd15..4d93adeb5a 100644 --- a/languages/LanguageZh.php +++ b/languages/LanguageZh.php @@ -2,7 +2,15 @@ require_once( "LanguageUtf8.php" ); require_once( "LanguageZh_cn.php"); require_once( "LanguageZh_tw.php"); -require_once( "ZhConversion.php"); + +/* caching the conversion tables */ +$zhSimp2Trad = $wgMemc->get($key1 = "$wgDBname:zhConvert:s2t"); +$zhTrad2Simp = $wgMemc->get($key2 = "$wgDBname:zhConvert:t2s"); +if(empty($zhSimp2Trad) || empty($zhTrad2Simp)) { + require_once("includes/ZhConversion.php"); + $wgMemc->set($key1, $zhSimp2Trad); + $wgMemc->set($key2, $zhTrad2Simp); +} /* class that handles both Traditional and Simplified Chinese right now it only distinguish zh_cn and zh_tw (actuall, zh_cn and @@ -53,13 +61,13 @@ class LanguageZh extends LanguageUtf8 { /* the Simplified/Traditional conversion stuff */ function simp2trad($text) { - global $wgZhSimp2Trad; - return strtr($text, $wgZhSimp2Trad); + global $zhSimp2Trad; + return strtr($text, $zhSimp2Trad); } function trad2simp($text) { - global $wgZhTrad2Simp; - return strtr($text, $wgZhTrad2Simp); + global $zhTrad2Simp; + return strtr($text, $zhTrad2Simp); } function autoConvert($text) {