xref: /webtrees/app/Module/LanguagePolish.php (revision 059898c926a4478bc49a5a58f1ac1c58d0ea796d)
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\LocalePl;
24use Fisharebest\Webtrees\Encodings\UTF8;
25
26/**
27 * Class LanguagePolish.
28 */
29class LanguagePolish 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_ACUTE,
45            'D',
46            'E',
47            'F',
48            'G',
49            'H',
50            'I',
51            'J',
52            'K',
53            'L',
54            UTF8::LATIN_CAPITAL_LETTER_L_WITH_STROKE,
55            'M',
56            'N',
57            'O',
58            UTF8::LATIN_CAPITAL_LETTER_O_WITH_ACUTE,
59            'P',
60            'Q',
61            'R',
62            'S',
63            UTF8::LATIN_CAPITAL_LETTER_S_WITH_ACUTE,
64            'T',
65            'U',
66            'V',
67            'W',
68            'X',
69            'Y',
70            'Z',
71            UTF8::LATIN_CAPITAL_LETTER_Z_WITH_ACUTE,
72            UTF8::LATIN_CAPITAL_LETTER_Z_WITH_DOT_ABOVE,
73        ];
74    }
75
76    /**
77     * @return LocaleInterface
78     */
79    public function locale(): LocaleInterface
80    {
81        return new LocalePl();
82    }
83
84
85    /**
86     * Letters with diacritics that are considered distinct letters in this language.
87     *
88     * @return array<string,string>
89     */
90    protected function normalizeExceptions(): array
91    {
92        return [
93            'C' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
94            'L' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_CAPITAL_LETTER_L_WITH_STROKE,
95            'O' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_CAPITAL_LETTER_O_WITH_ACUTE,
96            'S' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_CAPITAL_LETTER_S_WITH_ACUTE,
97            'Z' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_ACUTE,
98            'Z' . UTF8::COMBINING_DOT_ABOVE            => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_DOT_ABOVE,
99            'c' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_SMALL_LETTER_C_WITH_ACUTE,
100            'l' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_SMALL_LETTER_L_WITH_STROKE,
101            'o' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_SMALL_LETTER_O_WITH_ACUTE,
102            's' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_SMALL_LETTER_S_WITH_ACUTE,
103            'z' . UTF8::COMBINING_ACUTE_ACCENT         => UTF8::LATIN_SMALL_LETTER_Z_WITH_ACUTE,
104            'z' . UTF8::COMBINING_DOT_ABOVE            => UTF8::LATIN_SMALL_LETTER_Z_WITH_DOT_ABOVE,
105        ];
106    }
107}
108