Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
6 / 9 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
TlyConverter | |
66.67% |
6 / 9 |
|
75.00% |
3 / 4 |
4.59 | |
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 / 3 |
|
0.00% |
0 / 1 |
2 | |||
loadDefaultTables | |
100.00% |
4 / 4 |
|
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 | * @author Amir E. Aharoni |
20 | */ |
21 | |
22 | /** |
23 | * Talysh specific code. |
24 | * |
25 | * @ingroup Languages |
26 | */ |
27 | class TlyConverter extends LanguageConverter { |
28 | /** |
29 | * The conversion table. |
30 | * The Cyrillic sequence is based on Pireyko's 1976 Talysh—Russian dictionary, |
31 | * with practical additions. |
32 | * The toCyrillic table is built by flipping this one. |
33 | */ |
34 | private const TO_LATIN = [ |
35 | 'а' => 'a', 'А' => 'A', |
36 | 'б' => 'b', 'Б' => 'B', |
37 | 'в' => 'v', 'В' => 'V', |
38 | 'г' => 'q', 'Г' => 'Q', // Not G! |
39 | 'ғ' => 'ğ', 'Ғ' => 'Ğ', |
40 | 'д' => 'd', 'Д' => 'D', |
41 | 'е' => 'e', 'Е' => 'E', |
42 | 'ә' => 'ə', 'Ә' => 'Ə', |
43 | 'ж' => 'j', 'Ж' => 'J', |
44 | 'з' => 'z', 'З' => 'Z', |
45 | |
46 | 'и' => 'i', 'И' => 'İ', // NB Dotted capital I |
47 | 'ы' => 'ı', 'Ы' => 'I', // NB Dotless small I |
48 | 'ј' => 'y', 'Ј' => 'Y', |
49 | 'к' => 'k', 'К' => 'K', |
50 | 'л' => 'l', 'Л' => 'L', |
51 | 'м' => 'm', 'М' => 'M', |
52 | 'н' => 'n', 'Н' => 'N', |
53 | 'о' => 'o', 'О' => 'O', |
54 | 'п' => 'p', 'П' => 'P', |
55 | 'р' => 'r', 'Р' => 'R', |
56 | |
57 | 'с' => 's', 'С' => 'S', |
58 | 'т' => 't', 'Т' => 'T', |
59 | 'у' => 'u', 'У' => 'U', // NB Not in the standard dictionary, but used in practice |
60 | 'ү' => 'ü', 'Ү' => 'Ü', |
61 | 'ф' => 'f', 'Ф' => 'F', |
62 | 'х' => 'x', 'Х' => 'X', |
63 | 'һ' => 'h', 'Һ' => 'H', |
64 | 'ч' => 'ç', 'Ч' => 'Ç', |
65 | 'ҹ' => 'c', 'Ҹ' => 'C', |
66 | 'ш' => 'ş', 'Ш' => 'Ş', |
67 | ]; |
68 | |
69 | public function getMainCode(): string { |
70 | return 'tly'; |
71 | } |
72 | |
73 | public function getLanguageVariants(): array { |
74 | return [ 'tly', 'tly-cyrl' ]; |
75 | } |
76 | |
77 | public function getVariantsFallbacks(): array { |
78 | return [ |
79 | 'tly-cyrl' => 'tly', |
80 | ]; |
81 | } |
82 | |
83 | protected function loadDefaultTables(): array { |
84 | return [ |
85 | 'tly-cyrl' => new ReplacementArray( array_flip( self::TO_LATIN ) ), |
86 | 'tly' => new ReplacementArray( self::TO_LATIN ), |
87 | ]; |
88 | } |
89 | } |