Change loading order of Chinese conversion tables
authorLiangent <liangent@gmail.com>
Thu, 4 Sep 2014 12:19:43 +0000 (12:19 +0000)
committerNemo bis <federicoleva@tiscali.it>
Thu, 8 Jan 2015 15:35:42 +0000 (15:35 +0000)
Apply the conversion variants from specific zones before zh-hans
and zh-hant, to allow fitting specific linguistic habits before
falling back to the generic ones. The actual rules will be added
in a followup patch.

Previously, the zh-cn table was composed by:

(1) Load zh2Hans as zh-hans table
(2) Load zh2CN + zh2Hans as zh-cn table
(3) Load Conversiontable/zh-hans + zh-hans as zh-hans table
(4) Load Conversiontable/zh-cn + zh-cn as zh-cn table
(5) Load zh-hans + zh-cn as the final zh-cn table

The new loading order is:

(1) Load zh2Hans as zh-hans table
(2) Load zh2CN as zh-cn table
(3) Load Conversiontable/zh-hans + zh-hans as zh-hans table
(4) Load Conversiontable/zh-cn + zh-cn as zh-cn table
(5) Load zh-cn + zh-hans as the final zh-cn table

Change-Id: Ie9d08b85d4911618946fa7efd23eb898412449e5

languages/classes/LanguageZh.php

index dfdc6b1..731b3f8 100644 (file)
@@ -67,23 +67,35 @@ class ZhConverter extends LanguageConverter {
                $this->mTables = array(
                        'zh-hans' => new ReplacementArray( $zh2Hans ),
                        'zh-hant' => new ReplacementArray( $zh2Hant ),
-                       'zh-cn' => new ReplacementArray( array_merge( $zh2Hans, $zh2CN ) ),
-                       'zh-hk' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
-                       'zh-mo' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
-                       'zh-my' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
-                       'zh-sg' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
-                       'zh-tw' => new ReplacementArray( array_merge( $zh2Hant, $zh2TW ) ),
+                       'zh-cn' => new ReplacementArray( $zh2CN ),
+                       'zh-hk' => new ReplacementArray( $zh2HK ),
+                       'zh-mo' => new ReplacementArray( $zh2HK ),
+                       'zh-my' => new ReplacementArray( $zh2SG ),
+                       'zh-sg' => new ReplacementArray( $zh2SG ),
+                       'zh-tw' => new ReplacementArray( $zh2TW ),
                        'zh' => new ReplacementArray
                );
        }
 
        function postLoadTables() {
-               $this->mTables['zh-cn']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-hk']->merge( $this->mTables['zh-hant'] );
-               $this->mTables['zh-mo']->merge( $this->mTables['zh-hant'] );
-               $this->mTables['zh-my']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-sg']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-tw']->merge( $this->mTables['zh-hant'] );
+               $this->mTables['zh-cn']->setArray(
+                       $this->mTables['zh-cn']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-hk']->setArray(
+                       $this->mTables['zh-hk']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
+               $this->mTables['zh-mo']->setArray(
+                       $this->mTables['zh-mo']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
+               $this->mTables['zh-my']->setArray(
+                       $this->mTables['zh-my']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-sg']->setArray(
+                       $this->mTables['zh-sg']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-tw']->setArray(
+                       $this->mTables['zh-tw']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
        }
 
        /**