xref: /webtrees/app/Module/LanguageSlovakian.php (revision b72623fe90bc26fec6728adcea680bb1dca08618)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2021 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\LocaleSk;
24use Fisharebest\Webtrees\Relationship;
25
26use function str_repeat;
27
28/**
29 * Class LanguageSlovakian.
30 */
31class LanguageSlovakian extends AbstractModule implements ModuleLanguageInterface
32{
33    use ModuleLanguageTrait;
34
35    protected const MALE_COUSINS = [
36        ['', ''],
37        ['bratranec', '%s bratranca'],
38        ['druhostupňový bratranec', '%s druhostupňového bratranca'],
39        ['bratranec z 3. kolena', '%s bratranca z 3. kolena'],
40        ['bratranec zo 4. kolena', '%s bratranca zo 4. kolena'],
41        ['bratranec z 5. kolena', '%s bratranca z 5. kolena'],
42        ['bratranec zo 6. kolena', '%s bratranca zo 6. kolena'],
43        ['bratranec zo 7. kolena', '%s bratranca zo 7. kolena'],
44        ['bratranec z 8. kolena', '%s bratranca z 8. kolena'],
45        ['bratranec z 9. kolena', '%s bratranca z 9. kolena'],
46        ['bratranec z 10. kolena', '%s bratranca z 10. kolena'],
47        ['bratranec z 11. kolena', '%s bratranca z 11. kolena'],
48        ['bratranec z 12. kolena', '%s bratranca z 12. kolena'],
49        ['bratranec z 13. kolena', '%s bratranca z 13. kolena'],
50        ['bratranec zo 14. kolena', '%s bratranca zo 14. kolena'],
51        ['bratranec z 15. kolena', '%s bratranca z 15. kolena'],
52        ['bratranec zo 16. kolena', '%s bratranca zo 16. kolena'],
53        ['bratranec zo 17. kolena', '%s bratranca zo 17. kolena'],
54    ];
55
56    protected const FEMALE_COUSINS = [
57        ['', ''],
58        ['sesternica', '%s sesternice'],
59        ['druhostupňová sesternica', '%s druhostupňovej sesternice'],
60        ['sesternica z 3. kolena', '%s sesternice z 3. kolena'],
61        ['sesternica zo 4. kolena', '%s sesternice zo 4. kolena'],
62        ['sesternica z 5. kolena', '%s sesternice z 5. kolena'],
63        ['sesternica zo 6. kolena', '%s sesternice zo 6. kolena'],
64        ['sesternica zo 7. kolena', '%s sesternice zo 7. kolena'],
65        ['sesternica z 8. kolena', '%s sesternice z 8. kolena'],
66        ['sesternica z 9. kolena', '%s sesternice z 9. kolena'],
67        ['sesternica z 10. kolena', '%s sesternice z 10. kolena'],
68        ['sesternica z 11. kolena', '%s sesternice z 11. kolena'],
69        ['sesternica z 12. kolena', '%s sesternice z 12. kolena'],
70        ['sesternica z 13. kolena', '%s sesternice z 13. kolena'],
71        ['sesternica zo 14. kolena', '%s sesternice zo 14. kolena'],
72        ['sesternica z 15. kolena', '%s sesternice z 15. kolena'],
73        ['sesternica zo 16. kolena', '%s sesternice zo 16. kolena'],
74        ['sesternica zo 17. kolena', '%s sesternice zo 17. kolena'],
75    ];
76
77    /**
78     * @return LocaleInterface
79     */
80    public function locale(): LocaleInterface
81    {
82        return new LocaleSk();
83    }
84    /**
85     * @return array<Relationship>
86     */
87    public function relationships(): array
88    {
89        $pra = fn (int $n, string $nominative, string $genitive): array => [
90            ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $nominative,
91            ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $genitive,
92        ];
93
94        $cousin = fn (int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [
95            $nominative . ' z ' . $n . '. kolena',
96            $genitive . '%s z ' . $n . '. kolena',
97        ];
98
99        return [
100            // Parents
101            Relationship::fixed('otec', '%s otca')->father(),
102            Relationship::fixed('matka', '%s matky')->mother(),
103            Relationship::fixed('rodič', '%s rodiča')->parent(),
104            // Children
105            Relationship::fixed('syn', '%s syna')->son(),
106            Relationship::fixed('dcéra', '%s dcéry')->daughter(),
107            Relationship::fixed('dieťa', '%s dieťaťa')->child(),
108            // Siblings
109            Relationship::fixed('brat', '%s brata')->brother(),
110            Relationship::fixed('sestra', '%s sestry')->sister(),
111            Relationship::fixed('súrodenec', '%s súrodenca')->sibling(),
112            // Divorced partners
113            Relationship::fixed('exmanželka', '%s exmanželky')->divorced()->partner()->female(),
114            Relationship::fixed('exmanžel', '%s exmanžela')->divorced()->partner()->male(),
115            Relationship::fixed('exmanžel/manželka', '%s exmanžela/manželky')->divorced()->partner(),
116            // Engaged partners
117            Relationship::fixed('snúbenec', '%s snúbence')->engaged()->partner()->female(),
118            Relationship::fixed('snúbenica', '%s snúbenice')->engaged()->partner()->male(),
119            // Married parters
120            Relationship::fixed('manželka', '%s manželky')->wife(),
121            Relationship::fixed('manžel', '%s manžela')->husband(),
122            Relationship::fixed('manžel/manželka', '%s manžela/manželky')->spouse(),
123            Relationship::fixed('partnerka', '%s partnerky')->partner()->female(),
124            // Unmarried partners
125            Relationship::fixed('partner', '%s partnera')->partner(),
126            // In-laws
127            Relationship::fixed('tesť', '%s tesťa')->wife()->father(),
128            Relationship::fixed('testiná', '%s testinej')->wife()->mother(),
129            Relationship::fixed('svokor', '%s svokra')->spouse()->father(),
130            Relationship::fixed('svokra', '%s svokry')->spouse()->mother(),
131            Relationship::fixed('zať', '%s zaťa')->child()->husband(),
132            Relationship::fixed('nevesta', '%s nevesty')->child()->wife(),
133            Relationship::fixed('švagor', '%s švagra')->spouse()->brother(),
134            Relationship::fixed('švagor', '%s švagra')->sibling()->husband(),
135            Relationship::fixed('švagriná', '%s švagrinej')->spouse()->sister(),
136            Relationship::fixed('švagriná', '%s švagrinej')->sibling()->wife(),
137            // Half-siblings
138            Relationship::fixed('nevlastný brat', '%s nevlastného brata')->parent()->son(),
139            Relationship::fixed('nevlastná sestra', '%s nevlastnej sestry')->parent()->daughter(),
140            Relationship::fixed('nevlastný súrodenec', '%s nevlastného súrodenca')->parent()->child(),
141            // Grandparents
142            Relationship::fixed('starý otec', '%s starého otca')->parent()->father(),
143            Relationship::fixed('stará matka', '%s starej matky')->parent()->mother(),
144            Relationship::fixed('starý rodič', '%s starého rodiča')->parent()->parent(),
145            // Great-grandparents
146            Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->father(),
147            Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->mother(),
148            Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->parent(),
149            // Ancestors
150            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(),
151            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(),
152            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(),
153            // Grandchildren
154            Relationship::fixed('vnuk', '%s vnuka')->child()->son(),
155            Relationship::fixed('vnučka', '%s vnučky')->child()->daughter(),
156            Relationship::fixed('vnúča', '%s vnúčaťa')->child()->child(),
157            // Great-grandchildren
158            Relationship::fixed('pravnuk', '%s pravnuka')->child()->child()->son(),
159            Relationship::fixed('pravnučka', '%s pravnučky')->child()->child()->daughter(),
160            Relationship::fixed('pravnúča', '%s pravnúčaťa')->child()->child()->child(),
161            // Descendants
162            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(),
163            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(),
164            Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(),
165            // Aunts and uncles
166            Relationship::fixed('ujo', '%s uja')->mother()->brother(),
167            Relationship::fixed('ujčiná', '%s ujčinej')->mother()->brother()->wife(),
168            Relationship::fixed('stryná', '%s strynej')->father()->brother()->wife(),
169            Relationship::fixed('strýko', '%s strýka')->parent()->brother(),
170            Relationship::fixed('teta', '%s tety')->parent()->sister(),
171            // Great-aunts and great-uncles
172            Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(),
173            Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(),
174            // Nieces and nephews
175            Relationship::fixed('neter', '%s netere')->sibling()->son(),
176            Relationship::fixed('synovec', '%s synovca')->sibling()->daughter(),
177            // Great-nieces and great-nephews
178            Relationship::fixed('prasynovec', '%s prasynovca')->sibling()->child()->son(),
179            Relationship::fixed('praneter', '%s pranetere')->sibling()->child()->daughter(),
180            Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(),
181            Relationship::dynamic(fn (int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(),
182            // Cousins
183            Relationship::dynamic(fn (int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(),
184            Relationship::dynamic(fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(),
185            Relationship::dynamic(fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(),
186        ];
187    }
188}
189