MediaWiki  1.30.0
LanguageGan.php
Go to the documentation of this file.
1 <?php
27 class GanConverter extends LanguageConverter {
36  function __construct( $langobj, $maincode,
37  $variants = [],
38  $variantfallbacks = [],
39  $flags = [],
40  $manualLevel = [] ) {
41  $this->mDescCodeSep = ':';
42  $this->mDescVarSep = ';';
43  parent::__construct( $langobj, $maincode,
44  $variants,
45  $variantfallbacks,
46  $flags,
47  $manualLevel );
48  $names = [
49  'gan' => '原文',
50  'gan-hans' => '简体',
51  'gan-hant' => '繁體',
52  ];
53  $this->mVariantNames = array_merge( $this->mVariantNames, $names );
54  }
55 
56  function loadDefaultTables() {
57  $this->mTables = [
58  'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hans ),
59  'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hant ),
60  'gan' => new ReplacementArray
61  ];
62  }
63 
68  function convertCategoryKey( $key ) {
69  return $this->autoConvert( $key, 'gan' );
70  }
71 }
72 
79 class LanguageGan extends LanguageZh {
80  function __construct() {
81  parent::__construct();
82 
83  $variants = [ 'gan', 'gan-hans', 'gan-hant' ];
84  $variantfallbacks = [
85  'gan' => [ 'gan-hans', 'gan-hant' ],
86  'gan-hans' => [ 'gan' ],
87  'gan-hant' => [ 'gan' ],
88  ];
89  $ml = [
90  'gan' => 'disable',
91  ];
92 
93  $this->mConverter = new GanConverter( $this, 'gan',
94  $variants, $variantfallbacks,
95  [],
96  $ml );
97  }
98 
106  function normalizeForSearch( $string, $autoVariant = 'gan-hans' ) {
107  // LanguageZh::normalizeForSearch
108  return parent::normalizeForSearch( $string, $autoVariant );
109  }
110 
111 }
LanguageZh
class that handles both Traditional and Simplified Chinese right now it only distinguish zh_hans,...
Definition: LanguageZh.php:112
GanConverter\loadDefaultTables
loadDefaultTables()
Definition: LanguageGan.php:56
LanguageGan\normalizeForSearch
normalizeForSearch( $string, $autoVariant='gan-hans')
word segmentation
Definition: LanguageGan.php:106
GanConverter\convertCategoryKey
convertCategoryKey( $key)
Definition: LanguageGan.php:68
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
MediaWiki
A helper class for throttling authentication attempts.
LanguageGan\__construct
__construct()
Definition: LanguageGan.php:80
ReplacementArray
Wrapper around strtr() that holds replacements.
Definition: ReplacementArray.php:24
LanguageGan
class that handles both Traditional and Simplified Chinese right now it only distinguish gan_hans,...
Definition: LanguageGan.php:79
GanConverter
Definition: LanguageGan.php:27
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2801
GanConverter\__construct
__construct( $langobj, $maincode, $variants=[], $variantfallbacks=[], $flags=[], $manualLevel=[])
Definition: LanguageGan.php:36