MediaWiki master
LanguageZh.php
Go to the documentation of this file.
1<?php
45 public function segmentForDiff( $text ) {
46 $text = str_replace( "\x0c", "\u{FFFD}", $text );
47 return preg_replace( '/[\xc0-\xff][\x80-\xbf]*/', "\x0c$0", $text );
48 }
49
50 public function unsegmentForDiff( $text ) {
51 return str_replace( "\x0c", '', $text );
52 }
53
54 protected function getSearchIndexVariant() {
55 return 'zh-hans';
56 }
57
58 public function convertForSearchResult( $termsArray ) {
59 $terms = implode( '|', $termsArray );
60 $terms = self::convertDoubleWidth( $terms );
61 $terms = implode( '|', $this->getConverterInternal()->autoConvertToAllVariants( $terms ) );
62 return array_unique( explode( '|', $terms ) );
63 }
64}
Simplified Chinese.
Chinese-specific code.
convertForSearchResult( $termsArray)
segmentForDiff( $text)
Add a formfeed character between each non-ASCII character, so that "word-level" diffs will effectivel...
getSearchIndexVariant()
Specify the language variant that should be used for search indexing.
unsegmentForDiff( $text)
And unsegment to show the result.
getConverterInternal()
Return the LanguageConverter for this language, convenience function for use in the language classes ...
static convertDoubleWidth( $string)
Convert double-width roman characters to single-width.