xref: /webtrees/app/Module/ModuleLanguageTrait.php (revision 89f7189b61a494347591c99bdb92afb7d8b66e1b)
111eb8581SGreg Roach<?php
23976b470SGreg Roach
311eb8581SGreg Roach/**
411eb8581SGreg Roach * webtrees: online genealogy
5*89f7189bSGreg Roach * Copyright (C) 2021 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
15*89f7189bSGreg 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;
2502086832SGreg Roach
2611eb8581SGreg Roach/**
2711eb8581SGreg Roach * Trait ModuleLanguageEventsTrait - default implementation of ModuleLanguageInterface.
2811eb8581SGreg Roach */
2911eb8581SGreg Roachtrait ModuleLanguageTrait
3011eb8581SGreg Roach{
313d8b2a8eSGreg Roach    /**
323d8b2a8eSGreg Roach     * How should this module be identified in the control panel, etc.?
333d8b2a8eSGreg Roach     *
343d8b2a8eSGreg Roach     * @return string
353d8b2a8eSGreg Roach     */
3602086832SGreg Roach    public function title(): string
3702086832SGreg Roach    {
3802086832SGreg Roach        return  $this->locale()->endonym();
3902086832SGreg Roach    }
4002086832SGreg Roach
413d8b2a8eSGreg Roach    /**
423d8b2a8eSGreg Roach     * A sentence describing what this module does.
433d8b2a8eSGreg Roach     *
443d8b2a8eSGreg Roach     * @return string
453d8b2a8eSGreg Roach     */
4602086832SGreg Roach    public function description(): string
4702086832SGreg Roach    {
483d8b2a8eSGreg Roach        return I18N::translate('Language') . ' — ' . $this->title() . ' — ' . $this->locale()->languageTag();
4902086832SGreg Roach    }
5002086832SGreg Roach
5102086832SGreg Roach    /**
5202086832SGreg Roach     * @return LocaleInterface
5302086832SGreg Roach     */
5402086832SGreg Roach    public function locale(): LocaleInterface
5502086832SGreg Roach    {
5602086832SGreg Roach        return new LocaleEnUs();
5702086832SGreg Roach    }
5811eb8581SGreg Roach}
59