| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Language; |
| 5 |
|
| 6 |
/* @note: Use of this class is currently disabled in production, see T346657 */ |
| 7 |
/** Chinese conversion code. */ |
| 8 |
class LanguageZh extends Language { |
| 9 |
|
| 10 |
public function __construct() { |
| 11 |
$variants = [ |
| 12 |
'zh', |
| 13 |
'zh-hans', |
| 14 |
'zh-hant', |
| 15 |
'zh-cn', |
| 16 |
'zh-hk', |
| 17 |
'zh-mo', |
| 18 |
'zh-my', |
| 19 |
'zh-sg', |
| 20 |
'zh-tw' |
| 21 |
]; |
| 22 |
$variantfallbacks = [ |
| 23 |
'zh' => [ 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ], |
| 24 |
'zh-hans' => [ 'zh-cn', 'zh-sg', 'zh-my' ], |
| 25 |
'zh-hant' => [ 'zh-tw', 'zh-hk', 'zh-mo' ], |
| 26 |
'zh-cn' => [ 'zh-hans', 'zh-sg', 'zh-my' ], |
| 27 |
'zh-sg' => [ 'zh-hans', 'zh-cn', 'zh-my' ], |
| 28 |
'zh-my' => [ 'zh-hans', 'zh-sg', 'zh-cn' ], |
| 29 |
'zh-tw' => [ 'zh-hant', 'zh-hk', 'zh-mo' ], |
| 30 |
'zh-hk' => [ 'zh-hant', 'zh-mo', 'zh-tw' ], |
| 31 |
'zh-mo' => [ 'zh-hant', 'zh-hk', 'zh-tw' ], |
| 32 |
]; |
| 33 |
$manualLevel = [ |
| 34 |
'zh' => 'disable', |
| 35 |
'zh-hans' => 'unidirectional', |
| 36 |
'zh-hant' => 'unidirectional', |
| 37 |
]; |
| 38 |
$converter = new ZhConverter( |
| 39 |
$this, |
| 40 |
'zh', |
| 41 |
$variants, |
| 42 |
$variantfallbacks, |
| 43 |
[], |
| 44 |
$manualLevel |
| 45 |
); |
| 46 |
$this->setConverter( $converter ); |
| 47 |
} |
| 48 |
|
| 49 |
} |