38 $variantfallbacks = [],
41 $this->mDescCodeSep =
':';
42 $this->mDescVarSep =
';';
43 parent::__construct( $langobj, $maincode,
59 $this->mVariantNames = array_merge( $this->mVariantNames, $names );
77 $this->mTables[
'zh-cn']->setArray(
78 $this->mTables[
'zh-cn']->getArray() + $this->mTables[
'zh-hans']->getArray()
80 $this->mTables[
'zh-hk']->setArray(
81 $this->mTables[
'zh-hk']->getArray() + $this->mTables[
'zh-hant']->getArray()
83 $this->mTables[
'zh-mo']->setArray(
84 $this->mTables[
'zh-mo']->getArray() + $this->mTables[
'zh-hant']->getArray()
86 $this->mTables[
'zh-my']->setArray(
87 $this->mTables[
'zh-my']->getArray() + $this->mTables[
'zh-hans']->getArray()
89 $this->mTables[
'zh-sg']->setArray(
90 $this->mTables[
'zh-sg']->getArray() + $this->mTables[
'zh-hans']->getArray()
92 $this->mTables[
'zh-tw']->setArray(
93 $this->mTables[
'zh-tw']->getArray() + $this->mTables[
'zh-hant']->getArray()
114 parent::__construct();
128 $variantfallbacks = [
129 'zh' => [
'zh-hans',
'zh-hant',
'zh-cn',
'zh-tw',
'zh-hk',
'zh-sg',
'zh-mo',
'zh-my' ],
130 'zh-hans' => [
'zh-cn',
'zh-sg',
'zh-my' ],
131 'zh-hant' => [
'zh-tw',
'zh-hk',
'zh-mo' ],
132 'zh-cn' => [
'zh-hans',
'zh-sg',
'zh-my' ],
133 'zh-sg' => [
'zh-hans',
'zh-cn',
'zh-my' ],
134 'zh-my' => [
'zh-hans',
'zh-sg',
'zh-cn' ],
135 'zh-tw' => [
'zh-hant',
'zh-hk',
'zh-mo' ],
136 'zh-hk' => [
'zh-hant',
'zh-mo',
'zh-tw' ],
137 'zh-mo' => [
'zh-hant',
'zh-hk',
'zh-tw' ],
141 'zh-hans' =>
'unidirectional',
142 'zh-hant' =>
'unidirectional',
146 $variants, $variantfallbacks,
158 return preg_replace(
'/[\xc0-\xff][\x80-\xbf]*/',
' $0', $text );
166 return preg_replace(
'/ ([\xc0-\xff][\x80-\xbf]*)/',
'$1', $text );
181 $s = $this->mConverter->autoConvert( $string, $autoVariant );
183 $s = parent::normalizeForSearch(
$s );
192 $terms = implode(
'|', $termsArray );
194 $terms = implode(
'|', $this->mConverter->autoConvertToAllVariants( $terms ) );
195 $ret = array_unique( explode(
'|', $terms ) );
Base class for language conversion.
autoConvert( $text, $toVariant=false)
Dictionary-based conversion.
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
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.
Wrapper around strtr() that holds replacements.
loadDefaultTables()
Load default conversion tables.
convertCategoryKey( $key)
__construct( $langobj, $maincode, $variants=[], $variantfallbacks=[], $flags=[], $manualLevel=[])
postLoadTables()
Hook for post processing after conversion tables are loaded.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret