xref: /webtrees/app/Module/LanguageSlovenian.php (revision d11be7027e34e3121be11cc025421873364403f9)
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\LocaleSl;
24use Fisharebest\Webtrees\Encodings\UTF8;
25
26/**
27 * Class LanguageSlovenian.
28 */
29class LanguageSlovenian 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            'A',
42            'B',
43            'C',
44            UTF8::LATIN_CAPITAL_LETTER_C_WITH_CARON,
45            UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
46            'D',
47            UTF8::LATIN_CAPITAL_LETTER_D_WITH_STROKE,
48            'E',
49            'F',
50            'G',
51            'H',
52            'I',
53            'J',
54            'K',
55            'L',
56            'M',
57            'N',
58            'O',
59            'P',
60            'Q',
61            'R',
62            'S',
63            UTF8::LATIN_CAPITAL_LETTER_S_WITH_CARON,
64            'T',
65            'U',
66            'V',
67            'W',
68            'X',
69            'Y',
70            'Z',
71            UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
72        ];
73    }
74
75    /**
76     * Should this module be enabled when it is first installed?
77     *
78     * @return bool
79     */
80    public function isEnabledByDefault(): bool
81    {
82        return false;
83    }
84
85    /**
86     * @return LocaleInterface
87     */
88    public function locale(): LocaleInterface
89    {
90        return new LocaleSl();
91    }
92
93    /**
94     * Letters with diacritics that are considered distinct letters in this language.
95     *
96     * @return array<string,string>
97     */
98    protected function normalizeExceptions(): array
99    {
100        return [
101            'C' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CARON,
102            'C' . UTF8::COMBINING_CEDILLA              => UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
103            'D' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_CAPITAL_LETTER_D_WITH_STROKE,
104            'S' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_S_WITH_CARON,
105            'Z' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
106            'c' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_C_WITH_CARON,
107            'c' . UTF8::COMBINING_CEDILLA              => UTF8::LATIN_SMALL_LETTER_C_WITH_ACUTE,
108            'd' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_SMALL_LETTER_D_WITH_STROKE,
109            's' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_S_WITH_CARON,
110            'z' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_Z_WITH_CARON,
111        ];
112    }
113}
114