diff options
Diffstat (limited to 'lib/public/L10N')
-rw-r--r-- | lib/public/L10N/IFactory.php | 47 | ||||
-rw-r--r-- | lib/public/L10N/ILanguageIterator.php | 33 |
2 files changed, 23 insertions, 57 deletions
diff --git a/lib/public/L10N/IFactory.php b/lib/public/L10N/IFactory.php index 35713862f07..aebd318dfad 100644 --- a/lib/public/L10N/IFactory.php +++ b/lib/public/L10N/IFactory.php @@ -1,35 +1,11 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Georg Ehrke <oc.list@georgehrke.com> - * @author Joas Schilling <coding@schilljs.com> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Citharel <nextcloud@tcit.fr> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ - namespace OCP\L10N; use OCP\IUser; @@ -78,7 +54,7 @@ interface IFactory { * @return string language code, defaults to 'en' if no other matches are found * @since 23.0.0 */ - public function findGenericLanguage(string $appId = null): string; + public function findGenericLanguage(?string $appId = null): string; /** * @param string|null $lang user language as default locale @@ -95,7 +71,7 @@ interface IFactory { * @return null|string * @since 14.0.1 */ - public function findLanguageFromLocale(string $app = 'core', string $locale = null); + public function findLanguageFromLocale(string $app = 'core', ?string $locale = null); /** * Find all available languages for an app @@ -128,6 +104,15 @@ interface IFactory { public function localeExists($locale); /** + * Return the language direction + * + * @param string $language + * @return 'ltr'|'rtl' + * @since 31.0.0 + */ + public function getLanguageDirection(string $language): string; + + /** * iterate through language settings (if provided) in this order: * 1. returns the forced language or: * 2. if applicable, the trunk of 1 (e.g. "fu" instead of "fu_BAR" @@ -141,7 +126,7 @@ interface IFactory { * * @since 14.0.0 */ - public function getLanguageIterator(IUser $user = null): ILanguageIterator; + public function getLanguageIterator(?IUser $user = null): ILanguageIterator; /** * returns the common language and other languages in an @@ -158,5 +143,5 @@ interface IFactory { * @return string * @since 20.0.0 */ - public function getUserLanguage(IUser $user = null): string; + public function getUserLanguage(?IUser $user = null): string; } diff --git a/lib/public/L10N/ILanguageIterator.php b/lib/public/L10N/ILanguageIterator.php index 534d4229b1c..27f850d4235 100644 --- a/lib/public/L10N/ILanguageIterator.php +++ b/lib/public/L10N/ILanguageIterator.php @@ -1,24 +1,8 @@ <?php + /** - * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCP\L10N; @@ -37,11 +21,10 @@ namespace OCP\L10N; * if settings are not present or truncating is not applicable, the iterator * skips to the next valid item itself * - * + * @template-extends \Iterator<int, string> * @since 14.0.0 */ interface ILanguageIterator extends \Iterator { - /** * Return the current element * @@ -53,22 +36,20 @@ interface ILanguageIterator extends \Iterator { * Move forward to next element * * @since 14.0.0 - * @return void */ - #[\ReturnTypeWillChange] - public function next(); + public function next(): void; /** * Return the key of the current element * * @since 14.0.0 */ - public function key():int; + public function key(): int; /** * Checks if current position is valid * * @since 14.0.0 */ - public function valid():bool; + public function valid(): bool; } |