xref: /webtrees/app/Module/ModuleLanguageTrait.php (revision 5bfc689774bb9a6401271c4ed15a6d50652c991b)
111eb8581SGreg Roach<?php
23976b470SGreg Roach
311eb8581SGreg Roach/**
411eb8581SGreg Roach * webtrees: online genealogy
5*5bfc6897SGreg Roach * Copyright (C) 2022 webtrees development team
611eb8581SGreg Roach * This program is free software: you can redistribute it and/or modify
711eb8581SGreg Roach * it under the terms of the GNU General Public License as published by
811eb8581SGreg Roach * the Free Software Foundation, either version 3 of the License, or
911eb8581SGreg Roach * (at your option) any later version.
1011eb8581SGreg Roach * This program is distributed in the hope that it will be useful,
1111eb8581SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1211eb8581SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1311eb8581SGreg Roach * GNU General Public License for more details.
1411eb8581SGreg 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/>.
1611eb8581SGreg Roach */
17fcfa147eSGreg Roach
1811eb8581SGreg Roachdeclare(strict_types=1);
1911eb8581SGreg Roach
2011eb8581SGreg Roachnamespace Fisharebest\Webtrees\Module;
2111eb8581SGreg Roach
2202086832SGreg Roachuse Fisharebest\Localization\Locale\LocaleEnUs;
2302086832SGreg Roachuse Fisharebest\Localization\Locale\LocaleInterface;
243d8b2a8eSGreg Roachuse Fisharebest\Webtrees\I18N;
256fcafd02SGreg Roachuse Fisharebest\Webtrees\Relationship;
2602086832SGreg Roach
2711eb8581SGreg Roach/**
2811eb8581SGreg Roach * Trait ModuleLanguageEventsTrait - default implementation of ModuleLanguageInterface.
2911eb8581SGreg Roach */
3011eb8581SGreg Roachtrait ModuleLanguageTrait
3111eb8581SGreg Roach{
323d8b2a8eSGreg Roach    /**
333d8b2a8eSGreg Roach     * How should this module be identified in the control panel, etc.?
343d8b2a8eSGreg Roach     *
353d8b2a8eSGreg Roach     * @return string
363d8b2a8eSGreg Roach     */
3702086832SGreg Roach    public function title(): string
3802086832SGreg Roach    {
3902086832SGreg Roach        return  $this->locale()->endonym();
4002086832SGreg Roach    }
4102086832SGreg Roach
423d8b2a8eSGreg Roach    /**
433d8b2a8eSGreg Roach     * A sentence describing what this module does.
443d8b2a8eSGreg Roach     *
453d8b2a8eSGreg Roach     * @return string
463d8b2a8eSGreg Roach     */
4702086832SGreg Roach    public function description(): string
4802086832SGreg Roach    {
493d8b2a8eSGreg Roach        return I18N::translate('Language') . ' — ' . $this->title() . ' — ' . $this->locale()->languageTag();
5002086832SGreg Roach    }
5102086832SGreg Roach
5202086832SGreg Roach    /**
5302086832SGreg Roach     * @return LocaleInterface
5402086832SGreg Roach     */
5502086832SGreg Roach    public function locale(): LocaleInterface
5602086832SGreg Roach    {
5702086832SGreg Roach        return new LocaleEnUs();
5802086832SGreg Roach    }
596fcafd02SGreg Roach
606fcafd02SGreg Roach    /**
616fcafd02SGreg Roach     * @return array<Relationship>
626fcafd02SGreg Roach     */
636fcafd02SGreg Roach    public function relationships(): array
646fcafd02SGreg Roach    {
656fcafd02SGreg Roach        return [];
666fcafd02SGreg Roach    }
6711eb8581SGreg Roach}
68