diff options
Diffstat (limited to 'languages/classes/LanguageZh.php')
-rw-r--r-- | languages/classes/LanguageZh.php | 74 |
1 files changed, 28 insertions, 46 deletions
diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index 63f90fd9..d4130183 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( __DIR__ . '/../LanguageConverter.php' ); -require_once( __DIR__ . '/LanguageZh_hans.php' ); +require_once __DIR__ . '/../LanguageConverter.php'; +require_once __DIR__ . '/LanguageZh_hans.php'; /** * @ingroup Language @@ -50,31 +50,31 @@ class ZhConverter extends LanguageConverter { $flags, $manualLevel ); $names = array( - 'zh' => '原文', + 'zh' => '原文', 'zh-hans' => '简体', 'zh-hant' => '繁體', - 'zh-cn' => '大陆', - 'zh-tw' => '台灣', - 'zh-hk' => '香港', - 'zh-mo' => '澳門', - 'zh-sg' => '新加坡', - 'zh-my' => '大马', + 'zh-cn' => '大陆', + 'zh-tw' => '台灣', + 'zh-hk' => '香港', + 'zh-mo' => '澳門', + 'zh-sg' => '新加坡', + 'zh-my' => '大马', ); $this->mVariantNames = array_merge( $this->mVariantNames, $names ); } function loadDefaultTables() { - require( __DIR__ . "/../../includes/ZhConversion.php" ); + require __DIR__ . "/../../includes/ZhConversion.php"; $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' => new ReplacementArray + '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' => new ReplacementArray ); } @@ -88,20 +88,6 @@ class ZhConverter extends LanguageConverter { } /** - * there shouldn't be any latin text in Chinese conversion, so no need - * to mark anything. - * $noParse is there for compatibility with LanguageConvert::markNoConversion - * - * @param $text string - * @param $noParse bool - * - * @return string - */ - function markNoConversion( $text, $noParse = false ) { - return $text; - } - - /** * @param $key string * @return String */ @@ -125,18 +111,18 @@ class LanguageZh extends LanguageZh_hans { $variants = array( 'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw' ); $variantfallbacks = array( - 'zh' => array( 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ), + 'zh' => array( 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ), 'zh-hans' => array( 'zh-cn', 'zh-sg', 'zh-my' ), 'zh-hant' => array( 'zh-tw', 'zh-hk', 'zh-mo' ), - 'zh-cn' => array( 'zh-hans', 'zh-sg', 'zh-my' ), - 'zh-sg' => array( 'zh-hans', 'zh-cn', 'zh-my' ), - 'zh-my' => array( 'zh-hans', 'zh-sg', 'zh-cn' ), - 'zh-tw' => array( 'zh-hant', 'zh-hk', 'zh-mo' ), - 'zh-hk' => array( 'zh-hant', 'zh-mo', 'zh-tw' ), - 'zh-mo' => array( 'zh-hant', 'zh-hk', 'zh-tw' ), + 'zh-cn' => array( 'zh-hans', 'zh-sg', 'zh-my' ), + 'zh-sg' => array( 'zh-hans', 'zh-cn', 'zh-my' ), + 'zh-my' => array( 'zh-hans', 'zh-sg', 'zh-cn' ), + 'zh-tw' => array( 'zh-hant', 'zh-hk', 'zh-mo' ), + 'zh-hk' => array( 'zh-hant', 'zh-mo', 'zh-tw' ), + 'zh-mo' => array( 'zh-hant', 'zh-hk', 'zh-tw' ), ); $ml = array( - 'zh' => 'disable', + 'zh' => 'disable', 'zh-hans' => 'unidirectional', 'zh-hant' => 'unidirectional', ); @@ -146,7 +132,7 @@ class LanguageZh extends LanguageZh_hans { array(), $ml ); - $wgHooks['ArticleSaveComplete'][] = $this->mConverter; + $wgHooks['PageContentSaveComplete'][] = $this->mConverter; } /** @@ -156,9 +142,7 @@ class LanguageZh extends LanguageZh_hans { * @return string */ function segmentForDiff( $text ) { - return preg_replace( - "/([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "' ' .\"$1\"", $text ); + return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', ' $0', $text ); } /** @@ -166,9 +150,7 @@ class LanguageZh extends LanguageZh_hans { * @return string */ function unsegmentForDiff( $text ) { - return preg_replace( - "/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e", - "\"$1\"", $text ); + return preg_replace( '/ ([\xc0-\xff][\x80-\xbf]*)/', '$1', $text ); } /** |