xref: /webtrees/app/Module/LanguageBulgarian.php (revision 7c293f8cf09d45266badbab657bce1adb8b38c5b)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2022 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\LocaleBg;
23use Fisharebest\Localization\Locale\LocaleInterface;
24use Fisharebest\Webtrees\Encodings\UTF8;
25
26/**
27 * Class LanguageBulgarian.
28 */
29class LanguageBulgarian 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_ZHE,
48            UTF8::CYRILLIC_CAPITAL_LETTER_ZE,
49            UTF8::CYRILLIC_CAPITAL_LETTER_I,
50            UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
51            UTF8::CYRILLIC_CAPITAL_LETTER_KA,
52            UTF8::CYRILLIC_CAPITAL_LETTER_EL,
53            UTF8::CYRILLIC_CAPITAL_LETTER_EM,
54            UTF8::CYRILLIC_CAPITAL_LETTER_EN,
55            UTF8::CYRILLIC_CAPITAL_LETTER_O,
56            UTF8::CYRILLIC_CAPITAL_LETTER_PE,
57            UTF8::CYRILLIC_CAPITAL_LETTER_ER,
58            UTF8::CYRILLIC_CAPITAL_LETTER_ES,
59            UTF8::CYRILLIC_CAPITAL_LETTER_TE,
60            UTF8::CYRILLIC_CAPITAL_LETTER_U,
61            UTF8::CYRILLIC_CAPITAL_LETTER_EF,
62            UTF8::CYRILLIC_CAPITAL_LETTER_HA,
63            UTF8::CYRILLIC_CAPITAL_LETTER_TSE,
64            UTF8::CYRILLIC_CAPITAL_LETTER_CHE,
65            UTF8::CYRILLIC_CAPITAL_LETTER_SHA,
66            UTF8::CYRILLIC_CAPITAL_LETTER_SHCHA,
67            UTF8::CYRILLIC_CAPITAL_LETTER_HARD_SIGN,
68            UTF8::CYRILLIC_CAPITAL_LETTER_YERU,
69            UTF8::CYRILLIC_CAPITAL_LETTER_SOFT_SIGN,
70            UTF8::CYRILLIC_CAPITAL_LETTER_E,
71            UTF8::CYRILLIC_CAPITAL_LETTER_YU,
72            UTF8::CYRILLIC_CAPITAL_LETTER_YA,
73        ];
74    }
75
76    /**
77     * @return LocaleInterface
78     */
79    public function locale(): LocaleInterface
80    {
81        return new LocaleBg();
82    }
83
84    /**
85     * Letters with diacritics that are considered distinct letters in this language.
86     *
87     * @return array<string,string>
88     */
89    protected function normalizeExceptions(): array
90    {
91        return [
92            UTF8::CYRILLIC_CAPITAL_LETTER_I . UTF8::COMBINING_BREVE => UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
93            UTF8::CYRILLIC_SMALL_LETTER_I . UTF8::COMBINING_BREVE   => UTF8::CYRILLIC_SMALL_LETTER_SHORT_I,
94        ];
95    }
96}
97