MediaWiki  master
LanguageGan.php
Go to the documentation of this file.
1 <?php
26 class GanConverter extends LanguageConverter {
35  public function __construct( Language $langobj, $maincode,
36  $variants = [],
37  $variantfallbacks = [],
38  $flags = [],
39  $manualLevel = []
40  ) {
41  $this->mDescCodeSep = ':';
42  $this->mDescVarSep = ';';
43  parent::__construct( $langobj, $maincode,
44  $variants,
45  $variantfallbacks,
46  $flags,
47  $manualLevel
48  );
49  $names = [
50  'gan' => '原文',
51  'gan-hans' => '简体',
52  'gan-hant' => '繁體',
53  ];
54  $this->mVariantNames = array_merge( $this->mVariantNames, $names );
55  }
56 
57  protected function loadDefaultTables() {
58  $this->mTables = [
59  'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hans ),
60  'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hant ),
61  'gan' => new ReplacementArray
62  ];
63  }
64 
69  public function convertCategoryKey( $key ) {
70  return $this->autoConvert( $key, 'gan' );
71  }
72 }
73 
82 class LanguageGan extends LanguageZh {
83  protected function newConverter() : LanguageConverter {
84  $variants = [ 'gan', 'gan-hans', 'gan-hant' ];
85  $variantfallbacks = [
86  'gan' => [ 'gan-hans', 'gan-hant' ],
87  'gan-hans' => [ 'gan' ],
88  'gan-hant' => [ 'gan' ],
89  ];
90  $ml = [
91  'gan' => 'disable',
92  ];
93 
94  return new GanConverter( $this, 'gan',
95  $variants, $variantfallbacks,
96  [],
97  $ml
98  );
99  }
100 
108  public function normalizeForSearch( $string, $autoVariant = 'gan-hans' ) {
109  // LanguageZh::normalizeForSearch
110  return parent::normalizeForSearch( $string, $autoVariant );
111  }
112 
113 }
LanguageZh
class that handles both Traditional and Simplified Chinese right now it only distinguish zh_hans,...
Definition: LanguageZh.php:114
GanConverter\loadDefaultTables
loadDefaultTables()
Definition: LanguageGan.php:57
LanguageGan\normalizeForSearch
normalizeForSearch( $string, $autoVariant='gan-hans')
word segmentation
Definition: LanguageGan.php:108
GanConverter\convertCategoryKey
convertCategoryKey( $key)
Definition: LanguageGan.php:69
GanConverter\__construct
__construct(Language $langobj, $maincode, $variants=[], $variantfallbacks=[], $flags=[], $manualLevel=[])
Definition: LanguageGan.php:35
MediaWiki
A helper class for throttling authentication attempts.
ReplacementArray
Wrapper around strtr() that holds replacements.
Definition: ReplacementArray.php:24
LanguageGan
Gan Chinese.
Definition: LanguageGan.php:82
GanConverter
Definition: LanguageGan.php:26
LanguageGan\newConverter
newConverter()
Construct a new LanguageConverter suitable for this language.
Definition: LanguageGan.php:83
Language
Internationalisation code.
Definition: Language.php:39