MediaWiki REL1_37
LanguageZh.php
Go to the documentation of this file.
1<?php
37 public function segmentForDiff( $text ) {
38 return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', ' $0', $text );
39 }
40
45 public function unsegmentForDiff( $text ) {
46 return preg_replace( '/ ([\xc0-\xff][\x80-\xbf]*)/', '$1', $text );
47 }
48
56 public function normalizeForSearch( $string, $autoVariant = 'zh-hans' ) {
57 // always convert to zh-hans before indexing. it should be
58 // better to use zh-hans for search, since conversion from
59 // Traditional to Simplified is less ambiguous than the
60 // other way around
61 $s = $this->getConverter()->autoConvert( $string, $autoVariant );
62 // LanguageZh_hans::normalizeForSearch
63 $s = parent::normalizeForSearch( $s );
64 return $s;
65 }
66
71 public function convertForSearchResult( $termsArray ) {
72 $terms = implode( '|', $termsArray );
73 $terms = self::convertDoubleWidth( $terms );
74 $terms = implode( '|', $this->getConverter()->autoConvertToAllVariants( $terms ) );
75 $ret = array_unique( explode( '|', $terms ) );
76 return $ret;
77 }
78}
Simplified Chinese.
class that handles both Traditional and Simplified Chinese right now it only distinguish zh_hans,...
convertForSearchResult( $termsArray)
segmentForDiff( $text)
this should give much better diff info
unsegmentForDiff( $text)
normalizeForSearch( $string, $autoVariant='zh-hans')
auto convert to zh-hans and normalize special characters.
static convertDoubleWidth( $string)
convert double-width roman characters to single-width.
autoConvertToAllVariants( $text)
convert text to all supported variants
getConverter()
Return the LanguageConverter used in the Language.
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s