Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
TgConverter
85.71% covered (warning)
85.71%
6 / 7
75.00% covered (warning)
75.00%
3 / 4
4.05
0.00% covered (danger)
0.00%
0 / 1
 getMainCode
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLanguageVariants
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariantsFallbacks
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 loadDefaultTables
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
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
21use MediaWiki\Language\LanguageConverter;
22use MediaWiki\Language\ReplacementArray;
23
24/**
25 * Tajik (Тоҷикӣ) specific code, converting Tajiki to Latin orthography.
26 *
27 * @ingroup Languages
28 */
29class TgConverter extends LanguageConverter {
30
31    private const TABLE = [
32        'а' => 'a',
33        'б' => 'b',
34        'в' => 'v',
35        'г' => 'g',
36        'д' => 'd',
37        'е' => 'e',
38        'ё' => 'jo',
39        'ж' => 'ƶ',
40        'з' => 'z',
41        'ии ' => 'iji ',
42        'и' => 'i',
43        'й' => 'j',
44        'к' => 'k',
45        'л' => 'l',
46        'м' => 'm',
47        'н' => 'n',
48        'о' => 'o',
49        'п' => 'p',
50        'р' => 'r',
51        'с' => 's',
52        'т' => 't',
53        'у' => 'u',
54        'ф' => 'f',
55        'х' => 'x',
56        'ч' => 'c',
57        'ш' => 'ş',
58        'ъ' => '\'',
59        'э' => 'e',
60        'ю' => 'ju',
61        'я' => 'ja',
62        'ғ' => 'ƣ',
63        'ӣ' => 'ī',
64        'қ' => 'q',
65        'ӯ' => 'ū',
66        'ҳ' => 'h',
67        'ҷ' => 'ç',
68        'ц' => 'ts',
69        'А' => 'A',
70        'Б' => 'B',
71        'В' => 'V',
72        'Г' => 'G',
73        'Д' => 'D',
74        'Е' => 'E',
75        'Ё' => 'Jo',
76        'Ж' => 'Ƶ',
77        'З' => 'Z',
78        'И' => 'I',
79        'Й' => 'J',
80        'К' => 'K',
81        'Л' => 'L',
82        'М' => 'M',
83        'Н' => 'N',
84        'О' => 'O',
85        'П' => 'P',
86        'Р' => 'R',
87        'С' => 'S',
88        'Т' => 'T',
89        'У' => 'U',
90        'Ф' => 'F',
91        'Х' => 'X',
92        'Ч' => 'C',
93        'Ш' => 'Ş',
94        'Ъ' => '\'',
95        'Э' => 'E',
96        'Ю' => 'Ju',
97        'Я' => 'Ja',
98        'Ғ' => 'Ƣ',
99        'Ӣ' => 'Ī',
100        'Қ' => 'Q',
101        'Ӯ' => 'Ū',
102        'Ҳ' => 'H',
103        'Ҷ' => 'Ç',
104        'Ц' => 'Ts',
105    ];
106
107    public function getMainCode(): string {
108        return 'tg';
109    }
110
111    public function getLanguageVariants(): array {
112        return [ 'tg', 'tg-latn' ];
113    }
114
115    public function getVariantsFallbacks(): array {
116        return [];
117    }
118
119    protected function loadDefaultTables(): array {
120        return [
121            'tg-latn' => new ReplacementArray( self::TABLE ),
122            'tg' => new ReplacementArray()
123        ];
124    }
125}