102086832SGreg Roach<?php 23976b470SGreg Roach 302086832SGreg Roach/** 402086832SGreg Roach * webtrees: online genealogy 55bfc6897SGreg Roach * Copyright (C) 2022 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\LocaleNn; 2402086832SGreg Roach 25*4a9a6095SGreg Roachuse function mb_substr; 26*4a9a6095SGreg Roach 2702086832SGreg Roach/** 2802086832SGreg Roach * Class LanguageNorwegianNynorsk. 2902086832SGreg Roach */ 3002086832SGreg Roachclass LanguageNorwegianNynorsk extends AbstractModule implements ModuleLanguageInterface 3102086832SGreg Roach{ 3202086832SGreg Roach use ModuleLanguageTrait; 3302086832SGreg Roach 3402086832SGreg Roach /** 35*4a9a6095SGreg Roach * Phone-book ordering of letters. 36*4a9a6095SGreg Roach * 37*4a9a6095SGreg Roach * @return array<int,string> 38*4a9a6095SGreg Roach */ 39*4a9a6095SGreg Roach public function alphabet(): array 40*4a9a6095SGreg Roach { 41*4a9a6095SGreg Roach return ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å']; 42*4a9a6095SGreg Roach } 43*4a9a6095SGreg Roach 44*4a9a6095SGreg Roach /** 45*4a9a6095SGreg Roach * Some languages treat certain letter-combinations as equivalent. 46*4a9a6095SGreg Roach * 47*4a9a6095SGreg Roach * @return array<string,string> 48*4a9a6095SGreg Roach */ 49*4a9a6095SGreg Roach public function equivalentLetters(): array 50*4a9a6095SGreg Roach { 51*4a9a6095SGreg Roach return ['aa' => 'å', 'aA' => 'å', 'Aa' => 'Å', 'AA' => 'Å']; 52*4a9a6095SGreg Roach } 53*4a9a6095SGreg Roach 54*4a9a6095SGreg Roach /** 55*4a9a6095SGreg Roach * Some languages use digraphs and trigraphs. 56*4a9a6095SGreg Roach * 57*4a9a6095SGreg Roach * @param string $string 58*4a9a6095SGreg Roach * 59*4a9a6095SGreg Roach * @return string 60*4a9a6095SGreg Roach */ 61*4a9a6095SGreg Roach public function initialLetter(string $string): string 62*4a9a6095SGreg Roach { 63*4a9a6095SGreg Roach if (str_starts_with($string, 'AA')) { 64*4a9a6095SGreg Roach return 'Å'; 65*4a9a6095SGreg Roach } 66*4a9a6095SGreg Roach 67*4a9a6095SGreg Roach return mb_substr($string, 0, 1); 68*4a9a6095SGreg Roach } 69*4a9a6095SGreg Roach 70*4a9a6095SGreg Roach /** 7102086832SGreg Roach * Should this module be enabled when it is first installed? 7202086832SGreg Roach * 7302086832SGreg Roach * @return bool 7402086832SGreg Roach */ 7502086832SGreg Roach public function isEnabledByDefault(): bool 7602086832SGreg Roach { 7702086832SGreg Roach return false; 7802086832SGreg Roach } 7902086832SGreg Roach 8002086832SGreg Roach /** 8102086832SGreg Roach * @return LocaleInterface 8202086832SGreg Roach */ 8302086832SGreg Roach public function locale(): LocaleInterface 8402086832SGreg Roach { 8502086832SGreg Roach return new LocaleNn(); 8602086832SGreg Roach } 8702086832SGreg Roach} 88