Update git submodules
[mediawiki.git] / includes / language / converters / TlyConverter.php
blob09207872bb20ab2da3f3ce6b6b05b2a61f01efb2
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.
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.
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
18 * @file
19 * @author Amir E. Aharoni
22 /**
23 * Talysh specific code.
25 * @ingroup Languages
27 class TlyConverter extends LanguageConverter {
28 /**
29 * @var string[]
30 * The conversion table.
31 * The Cyrillic sequence is based on Pireyko's 1976 Talysh—Russian dictionary,
32 * with practical additions.
33 * The toCyrillic table is built by flipping this one.
35 private $toLatin = [
36 'а' => 'a', 'А' => 'A',
37 'б' => 'b', 'Б' => 'B',
38 'в' => 'v', 'В' => 'V',
39 'г' => 'q', 'Г' => 'Q', // Not G!
40 'ғ' => 'ğ', 'Ғ' => 'Ğ',
41 'д' => 'd', 'Д' => 'D',
42 'е' => 'e', 'Е' => 'E',
43 'ә' => 'ə', 'Ә' => 'Ə',
44 'ж' => 'j', 'Ж' => 'J',
45 'з' => 'z', 'З' => 'Z',
47 'и' => 'i', 'И' => 'İ', // NB Dotted capital I
48 'ы' => 'ı', 'Ы' => 'I', // NB Dotless small I
49 'ј' => 'y', 'Ј' => 'Y',
50 'к' => 'k', 'К' => 'K',
51 'л' => 'l', 'Л' => 'L',
52 'м' => 'm', 'М' => 'M',
53 'н' => 'n', 'Н' => 'N',
54 'о' => 'o', 'О' => 'O',
55 'п' => 'p', 'П' => 'P',
56 'р' => 'r', 'Р' => 'R',
58 'с' => 's', 'С' => 'S',
59 'т' => 't', 'Т' => 'T',
60 'у' => 'u', 'У' => 'U', // NB Not in the standard dictionary, but used in practice
61 'ү' => 'ü', 'Ү' => 'Ü',
62 'ф' => 'f', 'Ф' => 'F',
63 'х' => 'x', 'Х' => 'X',
64 'һ' => 'h', 'Һ' => 'H',
65 'ч' => 'ç', 'Ч' => 'Ç',
66 'ҹ' => 'c', 'Ҹ' => 'C',
67 'ш' => 'ş', 'Ш' => 'Ş',
70 /**
71 * @var string[]
72 * Filled with data in loadDefaultTables by flipping $toLatin.
74 private $toCyrillic = [];
76 public function getMainCode(): string {
77 return 'tly';
80 public function getLanguageVariants(): array {
81 return [ 'tly', 'tly-cyrl' ];
84 public function getVariantsFallbacks(): array {
85 return [
86 'tly-cyrl' => 'tly',
90 protected function loadDefaultTables(): array {
91 $this->toCyrillic = array_flip( $this->toLatin );
93 return [
94 'tly-cyrl' => new ReplacementArray( $this->toCyrillic ),
95 'tly' => new ReplacementArray( $this->toLatin ),