Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
33.33% |
7 / 21 |
|
37.50% |
3 / 8 |
CRAP | |
0.00% |
0 / 1 |
GanConverter | |
33.33% |
7 / 21 |
|
37.50% |
3 / 8 |
26.96 | |
0.00% |
0 / 1 |
getMainCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLanguageVariants | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getVariantsFallbacks | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getAdditionalManualLevel | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDescVarSeparator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getVariantNames | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
loadDefaultTables | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
convertCategoryKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | use MediaWiki\Language\LanguageConverter; |
22 | use MediaWiki\Language\ReplacementArray; |
23 | |
24 | /** |
25 | * Gan Chinese specific code. |
26 | * |
27 | * @ingroup Languages |
28 | */ |
29 | class GanConverter extends LanguageConverter { |
30 | |
31 | public function getMainCode(): string { |
32 | return 'gan'; |
33 | } |
34 | |
35 | public function getLanguageVariants(): array { |
36 | return [ 'gan', 'gan-hans', 'gan-hant' ]; |
37 | } |
38 | |
39 | public function getVariantsFallbacks(): array { |
40 | return [ |
41 | 'gan' => [ 'gan-hans', 'gan-hant' ], |
42 | 'gan-hans' => [ 'gan' ], |
43 | 'gan-hant' => [ 'gan' ], |
44 | ]; |
45 | } |
46 | |
47 | /** |
48 | * Get manual level limit for supported variants. |
49 | * @since 1.36 |
50 | * |
51 | * @return array |
52 | */ |
53 | protected function getAdditionalManualLevel(): array { |
54 | return [ 'gan' => 'disable' ]; |
55 | } |
56 | |
57 | public function getDescVarSeparator(): string { |
58 | return '; '; |
59 | } |
60 | |
61 | public function getVariantNames(): array { |
62 | $names = [ |
63 | 'gan' => '原文', |
64 | 'gan-hans' => '简体', |
65 | 'gan-hant' => '繁體', |
66 | ]; |
67 | return array_merge( parent::getVariantNames(), $names ); |
68 | } |
69 | |
70 | protected function loadDefaultTables(): array { |
71 | return [ |
72 | 'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::ZH_TO_HANS ), |
73 | 'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::ZH_TO_HANT ), |
74 | 'gan' => new ReplacementArray |
75 | ]; |
76 | } |
77 | |
78 | public function convertCategoryKey( $key ) { |
79 | return $this->autoConvert( $key, 'gan' ); |
80 | } |
81 | } |