38 $variantfallbacks = [],
42 $this->mDescCodeSep =
':';
43 $this->mDescVarSep =
';';
44 parent::__construct( $langobj, $maincode,
61 $this->mVariantNames = array_merge( $this->mVariantNames, $names );
79 $this->mTables[
'zh-cn']->setArray(
80 $this->mTables[
'zh-cn']->getArray() + $this->mTables[
'zh-hans']->getArray()
82 $this->mTables[
'zh-hk']->setArray(
83 $this->mTables[
'zh-hk']->getArray() + $this->mTables[
'zh-hant']->getArray()
85 $this->mTables[
'zh-mo']->setArray(
86 $this->mTables[
'zh-mo']->getArray() + $this->mTables[
'zh-hant']->getArray()
88 $this->mTables[
'zh-my']->setArray(
89 $this->mTables[
'zh-my']->getArray() + $this->mTables[
'zh-hans']->getArray()
91 $this->mTables[
'zh-sg']->setArray(
92 $this->mTables[
'zh-sg']->getArray() + $this->mTables[
'zh-hans']->getArray()
94 $this->mTables[
'zh-tw']->setArray(
95 $this->mTables[
'zh-tw']->getArray() + $this->mTables[
'zh-hant']->getArray()
116 parent::__construct();
130 $variantfallbacks = [
131 'zh' => [
'zh-hans',
'zh-hant',
'zh-cn',
'zh-tw',
'zh-hk',
'zh-sg',
'zh-mo',
'zh-my' ],
132 'zh-hans' => [
'zh-cn',
'zh-sg',
'zh-my' ],
133 'zh-hant' => [
'zh-tw',
'zh-hk',
'zh-mo' ],
134 'zh-cn' => [
'zh-hans',
'zh-sg',
'zh-my' ],
135 'zh-sg' => [
'zh-hans',
'zh-cn',
'zh-my' ],
136 'zh-my' => [
'zh-hans',
'zh-sg',
'zh-cn' ],
137 'zh-tw' => [
'zh-hant',
'zh-hk',
'zh-mo' ],
138 'zh-hk' => [
'zh-hant',
'zh-mo',
'zh-tw' ],
139 'zh-mo' => [
'zh-hant',
'zh-hk',
'zh-tw' ],
143 'zh-hans' =>
'unidirectional',
144 'zh-hant' =>
'unidirectional',
148 $variants, $variantfallbacks,
161 return preg_replace(
'/[\xc0-\xff][\x80-\xbf]*/',
' $0', $text );
169 return preg_replace(
'/ ([\xc0-\xff][\x80-\xbf]*)/',
'$1', $text );
184 $s = $this->mConverter->autoConvert( $string, $autoVariant );
186 $s = parent::normalizeForSearch(
$s );
195 $terms = implode(
'|', $termsArray );
197 $terms = implode(
'|', $this->mConverter->autoConvertToAllVariants( $terms ) );
198 $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.
Internationalisation code.
static convertDoubleWidth( $string)
convert double-width roman characters to single-width.
Wrapper around strtr() that holds replacements.
loadDefaultTables()
Load default conversion tables.
convertCategoryKey( $key)
postLoadTables()
Hook for post processing after conversion tables are loaded.
__construct(Language $langobj, $maincode, $variants=[], $variantfallbacks=[], $flags=[], $manualLevel=[])