xref: /webtrees/app/Module/LanguageFinnish.php (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
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\LocaleFi;
23use Fisharebest\Localization\Locale\LocaleInterface;
24use Fisharebest\Webtrees\Encodings\UTF8;
25
26/**
27 * Class LanguageFinnish.
28 */
29class LanguageFinnish 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            'D',
45            'E',
46            'F',
47            'G',
48            'H',
49            'I',
50            'J',
51            'K',
52            'L',
53            'M',
54            'N',
55            'O',
56            'P',
57            'Q',
58            'R',
59            'S',
60            'T',
61            'U',
62            'V',
63            'W',
64            'X',
65            'Y',
66            'Z',
67            UTF8::LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE,
68            UTF8::LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS,
69            UTF8::LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS,
70        ];
71    }
72
73    /**
74     * @return LocaleInterface
75     */
76    public function locale(): LocaleInterface
77    {
78        return new LocaleFi();
79    }
80
81    /**
82     * Letters with diacritics that are considered distinct letters in this language.
83     *
84     * @return array<string,string>
85     */
86    protected function normalizeExceptions(): array
87    {
88        return [
89            'A' . UTF8::COMBINING_RING_ABOVE => UTF8::LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE,
90            'A' . UTF8::COMBINING_DIAERESIS  => UTF8::LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS,
91            'O' . UTF8::COMBINING_DIAERESIS  => UTF8::LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS,
92            'a' . UTF8::COMBINING_RING_ABOVE => UTF8::LATIN_SMALL_LETTER_A_WITH_RING_ABOVE,
93            'a' . UTF8::COMBINING_DIAERESIS  => UTF8::LATIN_SMALL_LETTER_A_WITH_DIAERESIS,
94            'o' . UTF8::COMBINING_DIAERESIS  => UTF8::LATIN_SMALL_LETTER_O_WITH_DIAERESIS,
95        ];
96    }
97}
98