2009-03-23 19:10:28 +00:00
|
|
|
|
<?php
|
2012-06-06 20:42:13 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Gan Chinese specific code.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
*
|
|
|
|
|
|
* @file
|
|
|
|
|
|
*/
|
2009-03-23 19:10:28 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
|
*/
|
|
|
|
|
|
class GanConverter extends LanguageConverter {
|
2011-05-29 16:32:05 +00:00
|
|
|
|
/**
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @param Language $langobj
|
|
|
|
|
|
* @param string $maincode
|
|
|
|
|
|
* @param array $variants
|
|
|
|
|
|
* @param array $variantfallbacks
|
|
|
|
|
|
* @param array $flags
|
|
|
|
|
|
* @param array $manualLevel
|
2011-05-29 16:32:05 +00:00
|
|
|
|
*/
|
2017-10-04 19:02:29 +00:00
|
|
|
|
function __construct( Language $langobj, $maincode,
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$variants = [],
|
|
|
|
|
|
$variantfallbacks = [],
|
|
|
|
|
|
$flags = [],
|
|
|
|
|
|
$manualLevel = [] ) {
|
2009-03-23 19:10:28 +00:00
|
|
|
|
$this->mDescCodeSep = ':';
|
|
|
|
|
|
$this->mDescVarSep = ';';
|
2010-07-29 09:43:18 +00:00
|
|
|
|
parent::__construct( $langobj, $maincode,
|
2014-04-21 18:43:15 +00:00
|
|
|
|
$variants,
|
|
|
|
|
|
$variantfallbacks,
|
|
|
|
|
|
$flags,
|
|
|
|
|
|
$manualLevel );
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$names = [
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'gan' => '原文',
|
2009-03-23 19:10:28 +00:00
|
|
|
|
'gan-hans' => '简体',
|
|
|
|
|
|
'gan-hant' => '繁體',
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2010-07-29 09:43:18 +00:00
|
|
|
|
$this->mVariantNames = array_merge( $this->mVariantNames, $names );
|
2009-03-23 19:10:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadDefaultTables() {
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$this->mTables = [
|
2016-01-29 05:19:58 +00:00
|
|
|
|
'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hans ),
|
|
|
|
|
|
'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::$zh2Hant ),
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'gan' => new ReplacementArray
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2009-03-23 19:10:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2011-05-29 16:32:05 +00:00
|
|
|
|
/**
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @param string $key
|
|
|
|
|
|
* @return string
|
2011-05-29 16:32:05 +00:00
|
|
|
|
*/
|
2009-03-23 19:10:28 +00:00
|
|
|
|
function convertCategoryKey( $key ) {
|
|
|
|
|
|
return $this->autoConvert( $key, 'gan' );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-12-01 10:02:26 +00:00
|
|
|
|
* Gan Chinese
|
|
|
|
|
|
*
|
2009-03-23 19:10:28 +00:00
|
|
|
|
* class that handles both Traditional and Simplified Chinese
|
|
|
|
|
|
* right now it only distinguish gan_hans, gan_hant.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
|
*/
|
|
|
|
|
|
class LanguageGan extends LanguageZh {
|
|
|
|
|
|
function __construct() {
|
|
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
|
$variants = [ 'gan', 'gan-hans', 'gan-hant' ];
|
|
|
|
|
|
$variantfallbacks = [
|
|
|
|
|
|
'gan' => [ 'gan-hans', 'gan-hant' ],
|
|
|
|
|
|
'gan-hans' => [ 'gan' ],
|
|
|
|
|
|
'gan-hant' => [ 'gan' ],
|
|
|
|
|
|
];
|
|
|
|
|
|
$ml = [
|
2013-04-17 19:10:02 +00:00
|
|
|
|
'gan' => 'disable',
|
2016-02-17 09:09:32 +00:00
|
|
|
|
];
|
2009-03-23 19:10:28 +00:00
|
|
|
|
|
|
|
|
|
|
$this->mConverter = new GanConverter( $this, 'gan',
|
2014-04-21 18:43:15 +00:00
|
|
|
|
$variants, $variantfallbacks,
|
2016-02-17 09:09:32 +00:00
|
|
|
|
[],
|
2014-04-21 18:43:15 +00:00
|
|
|
|
$ml );
|
2009-03-23 19:10:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2011-05-29 16:32:05 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* word segmentation
|
|
|
|
|
|
*
|
2014-04-17 13:31:28 +00:00
|
|
|
|
* @param string $string
|
|
|
|
|
|
* @param string $autoVariant
|
|
|
|
|
|
* @return string
|
2011-05-29 16:32:05 +00:00
|
|
|
|
*/
|
2010-02-02 15:09:01 +00:00
|
|
|
|
function normalizeForSearch( $string, $autoVariant = 'gan-hans' ) {
|
|
|
|
|
|
// LanguageZh::normalizeForSearch
|
|
|
|
|
|
return parent::normalizeForSearch( $string, $autoVariant );
|
2009-03-23 19:10:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2010-01-19 02:36:33 +00:00
|
|
|
|
}
|