xref: /webtrees/app/Module/LanguageTatar.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2023 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Module;
21
22use Fisharebest\Localization\Locale\LocaleInterface;
23use Fisharebest\Localization\Locale\LocaleTt;
24use Fisharebest\Webtrees\Encodings\UTF8;
25
26/**
27 * Class LanguageTatar.
28 */
29class LanguageTatar extends AbstractModule implements ModuleLanguageInterface
30{
31    use ModuleLanguageTrait;
32
33    /**
34     * Phone-book ordering of letters.
35     *
36     * @return array<int,string>
37     */
38    public function alphabet(): array
39    {
40        return [
41            UTF8::CYRILLIC_CAPITAL_LETTER_A,
42            UTF8::CYRILLIC_CAPITAL_LETTER_BE,
43            UTF8::CYRILLIC_CAPITAL_LETTER_VE,
44            UTF8::CYRILLIC_CAPITAL_LETTER_GHE,
45            UTF8::CYRILLIC_CAPITAL_LETTER_DE,
46            UTF8::CYRILLIC_CAPITAL_LETTER_IE,
47            UTF8::CYRILLIC_CAPITAL_LETTER_IO,
48            UTF8::CYRILLIC_CAPITAL_LETTER_ZHE,
49            UTF8::CYRILLIC_CAPITAL_LETTER_ZE,
50            UTF8::CYRILLIC_CAPITAL_LETTER_I,
51            UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
52            UTF8::CYRILLIC_CAPITAL_LETTER_KA,
53            UTF8::CYRILLIC_CAPITAL_LETTER_EL,
54            UTF8::CYRILLIC_CAPITAL_LETTER_EM,
55            UTF8::CYRILLIC_CAPITAL_LETTER_EN,
56            UTF8::CYRILLIC_CAPITAL_LETTER_O,
57            UTF8::CYRILLIC_CAPITAL_LETTER_PE,
58            UTF8::CYRILLIC_CAPITAL_LETTER_ER,
59            UTF8::CYRILLIC_CAPITAL_LETTER_ES,
60            UTF8::CYRILLIC_CAPITAL_LETTER_TE,
61            UTF8::CYRILLIC_CAPITAL_LETTER_U,
62            UTF8::CYRILLIC_CAPITAL_LETTER_EF,
63            UTF8::CYRILLIC_CAPITAL_LETTER_HA,
64            UTF8::CYRILLIC_CAPITAL_LETTER_TSE,
65            UTF8::CYRILLIC_CAPITAL_LETTER_CHE,
66            UTF8::CYRILLIC_CAPITAL_LETTER_SHA,
67            UTF8::CYRILLIC_CAPITAL_LETTER_SHCHA,
68            UTF8::CYRILLIC_CAPITAL_LETTER_HARD_SIGN,
69            UTF8::CYRILLIC_CAPITAL_LETTER_YERU,
70            UTF8::CYRILLIC_CAPITAL_LETTER_SOFT_SIGN,
71            UTF8::CYRILLIC_CAPITAL_LETTER_E,
72            UTF8::CYRILLIC_CAPITAL_LETTER_YU,
73            UTF8::CYRILLIC_CAPITAL_LETTER_YA,
74        ];
75    }
76
77    /**
78     * Should this module be enabled when it is first installed?
79     *
80     * @return bool
81     */
82    public function isEnabledByDefault(): bool
83    {
84        return false;
85    }
86
87    /**
88     * @return LocaleInterface
89     */
90    public function locale(): LocaleInterface
91    {
92        return new LocaleTt();
93    }
94
95    /**
96     * Letters with diacritics that are considered distinct letters in this language.
97     *
98     * @return array<string,string>
99     */
100    protected function normalizeExceptions(): array
101    {
102        return [
103            UTF8::CYRILLIC_CAPITAL_LETTER_IE . UTF8::COMBINING_DIAERESIS => UTF8::CYRILLIC_CAPITAL_LETTER_IO,
104            UTF8::CYRILLIC_SMALL_LETTER_IE . UTF8::COMBINING_DIAERESIS   => UTF8::CYRILLIC_SMALL_LETTER_IO,
105            UTF8::CYRILLIC_CAPITAL_LETTER_I . UTF8::COMBINING_BREVE      => UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
106            UTF8::CYRILLIC_SMALL_LETTER_I . UTF8::COMBINING_BREVE        => UTF8::CYRILLIC_SMALL_LETTER_SHORT_I,
107        ];
108    }
109}
110