From 2e0b23d6899dbed6275bf51c3e429b9ad2c2ca74 Mon Sep 17 00:00:00 2001 From: Liangent Date: Thu, 4 Sep 2014 12:19:43 +0000 Subject: [PATCH] Change loading order of Chinese conversion tables 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 | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index dfdc6b1f87..731b3f8fc9 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -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() + ); } /** -- 2.20.1