Issues (2491)

app/Module/LanguageDutch.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2025 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
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Module;
21
22
use Fisharebest\Localization\Locale\LocaleInterface;
23
use Fisharebest\Localization\Locale\LocaleNl;
24
use Fisharebest\Webtrees\Encodings\UTF8;
0 ignored issues
show
The type Fisharebest\Webtrees\Encodings\UTF8 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
26
use function mb_substr;
27
use function str_starts_with;
28
29
class LanguageDutch extends AbstractModule implements ModuleLanguageInterface
30
{
31
    use ModuleLanguageTrait;
32
33
    /**
34
     * @return array<int,string>
35
     */
36
    public function alphabet(): array
37
    {
38
        return [
39
            'A',
40
            'B',
41
            'C',
42
            'D',
43
            'E',
44
            'F',
45
            'G',
46
            'H',
47
            'I',
48
            'J',
49
            'K',
50
            'L',
51
            'M',
52
            'N',
53
            'O',
54
            'P',
55
            'Q',
56
            'R',
57
            'S',
58
            'T',
59
            'U',
60
            'V',
61
            'W',
62
            'X',
63
            'Y',
64
            'Z',
65
            'IJ',
66
        ];
67
    }
68
69
    public function initialLetter(string $string): string
70
    {
71
        if (str_starts_with($string, 'IJ')) {
72
            return 'IJ';
73
        }
74
75
        return mb_substr($string, 0, 1);
76
    }
77
78
    public function locale(): LocaleInterface
79
    {
80
        return new LocaleNl();
81
    }
82
83
    /**
84
     * Letters with diacritics that are considered distinct letters in this language.
85
     *
86
     * @return array<string,string>
87
     */
88
    protected function normalizeExceptions(): array
89
    {
90
        return [
91
            'IJ' => UTF8::LATIN_CAPITAL_LIGATURE_IJ,
92
            'Ij' => UTF8::LATIN_CAPITAL_LIGATURE_IJ,
93
            'ij' => UTF8::LATIN_SMALL_LIGATURE_IJ,
94
            'iJ' => UTF8::LATIN_SMALL_LIGATURE_IJ,
95
        ];
96
    }
97
}
98