3 * Gan Chinese specific code.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
27 class GanConverter
extends LanguageConverter
{
29 * @param Language $langobj
30 * @param string $maincode
31 * @param array $variants
32 * @param array $variantfallbacks
34 * @param array $manualLevel
36 function __construct( $langobj, $maincode,
38 $variantfallbacks = array(),
40 $manualLevel = array() ) {
41 $this->mDescCodeSep
= ':';
42 $this->mDescVarSep
= ';';
43 parent
::__construct( $langobj, $maincode,
53 $this->mVariantNames
= array_merge( $this->mVariantNames
, $names );
56 function loadDefaultTables() {
57 $this->mTables
= array(
58 'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion
::$zh2Hans ),
59 'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion
::$zh2Hant ),
60 'gan' => new ReplacementArray
68 function convertCategoryKey( $key ) {
69 return $this->autoConvert( $key, 'gan' );
74 * class that handles both Traditional and Simplified Chinese
75 * right now it only distinguish gan_hans, gan_hant.
79 class LanguageGan
extends LanguageZh
{
80 function __construct() {
82 parent
::__construct();
84 $variants = array( 'gan', 'gan-hans', 'gan-hant' );
85 $variantfallbacks = array(
86 'gan' => array( 'gan-hans', 'gan-hant' ),
87 'gan-hans' => array( 'gan' ),
88 'gan-hant' => array( 'gan' ),
94 $this->mConverter
= new GanConverter( $this, 'gan',
95 $variants, $variantfallbacks,
99 $wgHooks['PageContentSaveComplete'][] = $this->mConverter
;
105 * @param string $string
106 * @param string $autoVariant
109 function normalizeForSearch( $string, $autoVariant = 'gan-hans' ) {
110 // LanguageZh::normalizeForSearch
111 return parent
::normalizeForSearch( $string, $autoVariant );