-/* caching the conversion tables */
-$zh2TW = $wgMemc->get($key1 = "$wgDBname:zhConvert:tw");
-$zh2CN = $wgMemc->get($key2 = "$wgDBname:zhConvert:cn");
-$zh2SG = $wgMemc->get($key3 = "$wgDBname:zhConvert:sg");
-$zh2HK = $wgMemc->get($key4 = "$wgDBname:zhConvert:hk");
-if(empty($zhSimp2Trad) || empty($zhTrad2Simp)) {
- require_once("includes/ZhConversion.php");
- $wgMemc->set($key1, $zh2TW);
- $wgMemc->set($key2, $zh2CN);
- $wgMemc->set($key3, $zh2SG);
- $wgMemc->set($key4, $zh2HK);
+
+class ZhConverter extends LanguageConverter {
+ function loadDefaultTables() {
+ require( "includes/ZhConversion.php" );
+ $this->mTables = array();
+ $this->mTables['zh-cn'] = $zh2CN;
+ $this->mTables['zh-tw'] = $zh2TW;
+ $this->mTables['zh-sg'] = array_merge($zh2CN, $zh2SG);
+ $this->mTables['zh-hk'] = array_merge($zh2TW, $zh2HK);
+ $this->mTables['zh'] = array();
+ }
+
+ function postLoadTables() {
+ $this->mTables['zh-sg'] = array_merge($this->mTables['zh-cn'], $this->mTables['zh-sg']);
+ $this->mTables['zh-hk'] = array_merge($this->mTables['zh-tw'], $this->mTables['zh-hk']);
+ }
+
+ /* there shouldn't be any latin text in Chinese conversion, so no need
+ to mark anything
+ */
+ function markNoConversion($text) {
+ return $text;
+ }
+
+ function convertCategoryKey( $key ) {
+ return $this->autoConvert( $key, 'zh-cn' );
+ }