102086832SGreg Roach<?php 23976b470SGreg Roach 302086832SGreg Roach/** 402086832SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 602086832SGreg Roach * This program is free software: you can redistribute it and/or modify 702086832SGreg Roach * it under the terms of the GNU General Public License as published by 802086832SGreg Roach * the Free Software Foundation, either version 3 of the License, or 902086832SGreg Roach * (at your option) any later version. 1002086832SGreg Roach * This program is distributed in the hope that it will be useful, 1102086832SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1202086832SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1302086832SGreg Roach * GNU General Public License for more details. 1402086832SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 1602086832SGreg Roach */ 17fcfa147eSGreg Roach 1802086832SGreg Roachdeclare(strict_types=1); 1902086832SGreg Roach 2002086832SGreg Roachnamespace Fisharebest\Webtrees\Module; 2102086832SGreg Roach 2202086832SGreg Roachuse Fisharebest\Localization\Locale\LocaleInterface; 2302086832SGreg Roachuse Fisharebest\Localization\Locale\LocaleSk; 246fcafd02SGreg Roachuse Fisharebest\Webtrees\Relationship; 256fcafd02SGreg Roach 264a9a6095SGreg Roachuse function mb_substr; 276fcafd02SGreg Roachuse function str_repeat; 284a9a6095SGreg Roachuse function str_starts_with; 2902086832SGreg Roach 3002086832SGreg Roach/** 3102086832SGreg Roach * Class LanguageSlovakian. 3202086832SGreg Roach */ 3302086832SGreg Roachclass LanguageSlovakian extends AbstractModule implements ModuleLanguageInterface 3402086832SGreg Roach{ 3502086832SGreg Roach use ModuleLanguageTrait; 3602086832SGreg Roach 376fcafd02SGreg Roach protected const MALE_COUSINS = [ 386fcafd02SGreg Roach ['', ''], 396fcafd02SGreg Roach ['bratranec', '%s bratranca'], 407af58572Sro-la ['druhostupňový bratranec', '%s druhostupňového bratranca'], 416fcafd02SGreg Roach ['bratranec z 3. kolena', '%s bratranca z 3. kolena'], 426fcafd02SGreg Roach ['bratranec zo 4. kolena', '%s bratranca zo 4. kolena'], 436fcafd02SGreg Roach ['bratranec z 5. kolena', '%s bratranca z 5. kolena'], 446fcafd02SGreg Roach ['bratranec zo 6. kolena', '%s bratranca zo 6. kolena'], 456fcafd02SGreg Roach ['bratranec zo 7. kolena', '%s bratranca zo 7. kolena'], 466fcafd02SGreg Roach ['bratranec z 8. kolena', '%s bratranca z 8. kolena'], 476fcafd02SGreg Roach ['bratranec z 9. kolena', '%s bratranca z 9. kolena'], 486fcafd02SGreg Roach ['bratranec z 10. kolena', '%s bratranca z 10. kolena'], 496fcafd02SGreg Roach ['bratranec z 11. kolena', '%s bratranca z 11. kolena'], 506fcafd02SGreg Roach ['bratranec z 12. kolena', '%s bratranca z 12. kolena'], 516fcafd02SGreg Roach ['bratranec z 13. kolena', '%s bratranca z 13. kolena'], 526fcafd02SGreg Roach ['bratranec zo 14. kolena', '%s bratranca zo 14. kolena'], 536fcafd02SGreg Roach ['bratranec z 15. kolena', '%s bratranca z 15. kolena'], 546fcafd02SGreg Roach ['bratranec zo 16. kolena', '%s bratranca zo 16. kolena'], 556fcafd02SGreg Roach ['bratranec zo 17. kolena', '%s bratranca zo 17. kolena'], 566fcafd02SGreg Roach ]; 576fcafd02SGreg Roach 586fcafd02SGreg Roach protected const FEMALE_COUSINS = [ 596fcafd02SGreg Roach ['', ''], 606fcafd02SGreg Roach ['sesternica', '%s sesternice'], 617af58572Sro-la ['druhostupňová sesternica', '%s druhostupňovej sesternice'], 626fcafd02SGreg Roach ['sesternica z 3. kolena', '%s sesternice z 3. kolena'], 636fcafd02SGreg Roach ['sesternica zo 4. kolena', '%s sesternice zo 4. kolena'], 646fcafd02SGreg Roach ['sesternica z 5. kolena', '%s sesternice z 5. kolena'], 656fcafd02SGreg Roach ['sesternica zo 6. kolena', '%s sesternice zo 6. kolena'], 666fcafd02SGreg Roach ['sesternica zo 7. kolena', '%s sesternice zo 7. kolena'], 676fcafd02SGreg Roach ['sesternica z 8. kolena', '%s sesternice z 8. kolena'], 686fcafd02SGreg Roach ['sesternica z 9. kolena', '%s sesternice z 9. kolena'], 696fcafd02SGreg Roach ['sesternica z 10. kolena', '%s sesternice z 10. kolena'], 706fcafd02SGreg Roach ['sesternica z 11. kolena', '%s sesternice z 11. kolena'], 716fcafd02SGreg Roach ['sesternica z 12. kolena', '%s sesternice z 12. kolena'], 726fcafd02SGreg Roach ['sesternica z 13. kolena', '%s sesternice z 13. kolena'], 736fcafd02SGreg Roach ['sesternica zo 14. kolena', '%s sesternice zo 14. kolena'], 746fcafd02SGreg Roach ['sesternica z 15. kolena', '%s sesternice z 15. kolena'], 756fcafd02SGreg Roach ['sesternica zo 16. kolena', '%s sesternice zo 16. kolena'], 766fcafd02SGreg Roach ['sesternica zo 17. kolena', '%s sesternice zo 17. kolena'], 776fcafd02SGreg Roach ]; 786fcafd02SGreg Roach 7902086832SGreg Roach /** 804a9a6095SGreg Roach * Phone-book ordering of letters. 814a9a6095SGreg Roach * 824a9a6095SGreg Roach * @return array<int,string> 834a9a6095SGreg Roach */ 844a9a6095SGreg Roach public function alphabet(): array 854a9a6095SGreg Roach { 864a9a6095SGreg Roach return ['A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'DZ', 'DŽ', 'E', 'É', 'F', 'G', 'H', 'CH', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž']; 874a9a6095SGreg Roach } 884a9a6095SGreg Roach 894a9a6095SGreg Roach /** 904a9a6095SGreg Roach * Some languages use digraphs and trigraphs. 914a9a6095SGreg Roach * 924a9a6095SGreg Roach * @param string $string 934a9a6095SGreg Roach * 944a9a6095SGreg Roach * @return string 954a9a6095SGreg Roach */ 964a9a6095SGreg Roach public function initialLetter(string $string): string 974a9a6095SGreg Roach { 984a9a6095SGreg Roach foreach (['CH', 'DZ', 'DŽ'] as $digraph) { 994a9a6095SGreg Roach if (str_starts_with($string, $digraph)) { 1004a9a6095SGreg Roach return $digraph; 1014a9a6095SGreg Roach } 1024a9a6095SGreg Roach } 1034a9a6095SGreg Roach 1044a9a6095SGreg Roach return mb_substr($string, 0, 1); 1054a9a6095SGreg Roach } 1064a9a6095SGreg Roach 1074a9a6095SGreg Roach /** 10802086832SGreg Roach * @return LocaleInterface 10902086832SGreg Roach */ 11002086832SGreg Roach public function locale(): LocaleInterface 11102086832SGreg Roach { 11202086832SGreg Roach return new LocaleSk(); 11302086832SGreg Roach } 1146fcafd02SGreg Roach /** 1156fcafd02SGreg Roach * @return array<Relationship> 1166fcafd02SGreg Roach */ 1176fcafd02SGreg Roach public function relationships(): array 1186fcafd02SGreg Roach { 11905babb96SGreg Roach $pra = static fn (int $n, string $nominative, string $genitive): array => [ 1206fcafd02SGreg Roach ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $nominative, 1216fcafd02SGreg Roach ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $genitive, 1226fcafd02SGreg Roach ]; 1236fcafd02SGreg Roach 12405babb96SGreg Roach $cousin = static fn (int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ 1256fcafd02SGreg Roach $nominative . ' z ' . $n . '. kolena', 1266fcafd02SGreg Roach $genitive . '%s z ' . $n . '. kolena', 1276fcafd02SGreg Roach ]; 1286fcafd02SGreg Roach 1296fcafd02SGreg Roach return [ 1306fcafd02SGreg Roach // Parents 1316fcafd02SGreg Roach Relationship::fixed('otec', '%s otca')->father(), 1326fcafd02SGreg Roach Relationship::fixed('matka', '%s matky')->mother(), 1336fcafd02SGreg Roach Relationship::fixed('rodič', '%s rodiča')->parent(), 1346fcafd02SGreg Roach // Children 1356fcafd02SGreg Roach Relationship::fixed('syn', '%s syna')->son(), 1366fcafd02SGreg Roach Relationship::fixed('dcéra', '%s dcéry')->daughter(), 1377af58572Sro-la Relationship::fixed('dieťa', '%s dieťaťa')->child(), 1386fcafd02SGreg Roach // Siblings 1396fcafd02SGreg Roach Relationship::fixed('brat', '%s brata')->brother(), 1406fcafd02SGreg Roach Relationship::fixed('sestra', '%s sestry')->sister(), 1416fcafd02SGreg Roach Relationship::fixed('súrodenec', '%s súrodenca')->sibling(), 1426fcafd02SGreg Roach // Divorced partners 1437af58572Sro-la Relationship::fixed('exmanželka', '%s exmanželky')->divorced()->partner()->female(), 1446fcafd02SGreg Roach Relationship::fixed('exmanžel', '%s exmanžela')->divorced()->partner()->male(), 1457af58572Sro-la Relationship::fixed('exmanžel/manželka', '%s exmanžela/manželky')->divorced()->partner(), 1466fcafd02SGreg Roach // Engaged partners 1477af58572Sro-la Relationship::fixed('snúbenec', '%s snúbence')->engaged()->partner()->female(), 1487af58572Sro-la Relationship::fixed('snúbenica', '%s snúbenice')->engaged()->partner()->male(), 1496fcafd02SGreg Roach // Married parters 1506fcafd02SGreg Roach Relationship::fixed('manželka', '%s manželky')->wife(), 1516fcafd02SGreg Roach Relationship::fixed('manžel', '%s manžela')->husband(), 1527af58572Sro-la Relationship::fixed('manžel/manželka', '%s manžela/manželky')->spouse(), 1536fcafd02SGreg Roach Relationship::fixed('partnerka', '%s partnerky')->partner()->female(), 1546fcafd02SGreg Roach // Unmarried partners 1556fcafd02SGreg Roach Relationship::fixed('partner', '%s partnera')->partner(), 1566fcafd02SGreg Roach // In-laws 1576fcafd02SGreg Roach Relationship::fixed('tesť', '%s tesťa')->wife()->father(), 1586fcafd02SGreg Roach Relationship::fixed('testiná', '%s testinej')->wife()->mother(), 1596fcafd02SGreg Roach Relationship::fixed('svokor', '%s svokra')->spouse()->father(), 1607af58572Sro-la Relationship::fixed('svokra', '%s svokry')->spouse()->mother(), 1616fcafd02SGreg Roach Relationship::fixed('zať', '%s zaťa')->child()->husband(), 1626fcafd02SGreg Roach Relationship::fixed('nevesta', '%s nevesty')->child()->wife(), 1636fcafd02SGreg Roach Relationship::fixed('švagor', '%s švagra')->spouse()->brother(), 1646fcafd02SGreg Roach Relationship::fixed('švagor', '%s švagra')->sibling()->husband(), 1656fcafd02SGreg Roach Relationship::fixed('švagriná', '%s švagrinej')->spouse()->sister(), 1666fcafd02SGreg Roach Relationship::fixed('švagriná', '%s švagrinej')->sibling()->wife(), 1676fcafd02SGreg Roach // Half-siblings 1686fcafd02SGreg Roach Relationship::fixed('nevlastný brat', '%s nevlastného brata')->parent()->son(), 1696fcafd02SGreg Roach Relationship::fixed('nevlastná sestra', '%s nevlastnej sestry')->parent()->daughter(), 1707af58572Sro-la Relationship::fixed('nevlastný súrodenec', '%s nevlastného súrodenca')->parent()->child(), 1716fcafd02SGreg Roach // Grandparents 1726fcafd02SGreg Roach Relationship::fixed('starý otec', '%s starého otca')->parent()->father(), 1736fcafd02SGreg Roach Relationship::fixed('stará matka', '%s starej matky')->parent()->mother(), 1746fcafd02SGreg Roach Relationship::fixed('starý rodič', '%s starého rodiča')->parent()->parent(), 1756fcafd02SGreg Roach // Great-grandparents 1766fcafd02SGreg Roach Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->father(), 1776fcafd02SGreg Roach Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->mother(), 1786fcafd02SGreg Roach Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->parent(), 1796fcafd02SGreg Roach // Ancestors 1806b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(), 1816b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(), 1826b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(), 1836fcafd02SGreg Roach // Grandchildren 1846fcafd02SGreg Roach Relationship::fixed('vnuk', '%s vnuka')->child()->son(), 1856fcafd02SGreg Roach Relationship::fixed('vnučka', '%s vnučky')->child()->daughter(), 1866fcafd02SGreg Roach Relationship::fixed('vnúča', '%s vnúčaťa')->child()->child(), 1876fcafd02SGreg Roach // Great-grandchildren 1886fcafd02SGreg Roach Relationship::fixed('pravnuk', '%s pravnuka')->child()->child()->son(), 1896fcafd02SGreg Roach Relationship::fixed('pravnučka', '%s pravnučky')->child()->child()->daughter(), 1906fcafd02SGreg Roach Relationship::fixed('pravnúča', '%s pravnúčaťa')->child()->child()->child(), 1916fcafd02SGreg Roach // Descendants 1926b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(), 1936b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(), 1946b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(), 1956fcafd02SGreg Roach // Aunts and uncles 1966fcafd02SGreg Roach Relationship::fixed('ujo', '%s uja')->mother()->brother(), 1976fcafd02SGreg Roach Relationship::fixed('ujčiná', '%s ujčinej')->mother()->brother()->wife(), 1986fcafd02SGreg Roach Relationship::fixed('stryná', '%s strynej')->father()->brother()->wife(), 1996fcafd02SGreg Roach Relationship::fixed('strýko', '%s strýka')->parent()->brother(), 2006fcafd02SGreg Roach Relationship::fixed('teta', '%s tety')->parent()->sister(), 2016fcafd02SGreg Roach // Great-aunts and great-uncles 2026b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(), 2036b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(), 2046fcafd02SGreg Roach // Nieces and nephews 205604d62afSro-la Relationship::fixed('synovec', '%s synovca')->sibling()->son(), 206604d62afSro-la Relationship::fixed('neter', '%s netere')->sibling()->daughter(), 2076fcafd02SGreg Roach // Great-nieces and great-nephews 2086fcafd02SGreg Roach Relationship::fixed('prasynovec', '%s prasynovca')->sibling()->child()->son(), 2096fcafd02SGreg Roach Relationship::fixed('praneter', '%s pranetere')->sibling()->child()->daughter(), 2106b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(), 2116b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(), 2126fcafd02SGreg Roach // Cousins 2136b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(), 2146b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(), 2156b2cb23eSGreg Roach Relationship::dynamic(static fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(), 2166fcafd02SGreg Roach ]; 2176fcafd02SGreg Roach } 21802086832SGreg Roach} 219