summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-07-13 17:25:51 +0200
committerGitHub <noreply@github.com>2018-07-13 17:25:51 +0200
commit14314584ba88ed8d8a7c8486b61c6677a14271f2 (patch)
treea24439cf1b1c243318532322d52d89fe4530fc47 /lib/public
parent1801e4e03f3a0b5ef253d67c13702b0fa22578a3 (diff)
parentca6094f3900fd463449d9973589b1d49aed28b2a (diff)
downloadnextcloud-server-14314584ba88ed8d8a7c8486b61c6677a14271f2.tar.gz
nextcloud-server-14314584ba88ed8d8a7c8486b61c6677a14271f2.zip
Merge pull request #10110 from nextcloud/feature/100500/whats-new-info-users
Display What's New info to users
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/L10N/IFactory.php16
-rw-r--r--lib/public/L10N/ILanguageIterator.php74
2 files changed, 86 insertions, 4 deletions
diff --git a/lib/public/L10N/IFactory.php b/lib/public/L10N/IFactory.php
index 9c006073200..1bc231e4e2e 100644
--- a/lib/public/L10N/IFactory.php
+++ b/lib/public/L10N/IFactory.php
@@ -21,6 +21,8 @@
*/
namespace OCP\L10N;
+use OCP\IUser;
+
/**
* @since 8.2.0
*/
@@ -93,10 +95,16 @@ interface IFactory {
/**
* iterate through language settings (if provided) in this order:
* 1. returns the forced language or:
- * 2. returns the user language or:
- * 3. returns the system default language or:
- * 4+∞. returns 'en'
+ * 2. if applicable, the trunk of 1 (e.g. "fu" instead of "fu_BAR"
+ * 3. returns the user language or:
+ * 4. if applicable, the trunk of 3
+ * 5. returns the system default language or:
+ * 6. if applicable, the trunk of 5
+ * 7+∞. returns 'en'
+ *
+ * Hint: in most cases findLanguage() suits you fine
+ *
* @since 14.0.0
*/
- public function iterateLanguage(bool $reset = false): string;
+ public function getLanguageIterator(IUser $user = null): ILanguageIterator;
}
diff --git a/lib/public/L10N/ILanguageIterator.php b/lib/public/L10N/ILanguageIterator.php
new file mode 100644
index 00000000000..ef923dfd249
--- /dev/null
+++ b/lib/public/L10N/ILanguageIterator.php
@@ -0,0 +1,74 @@
+<?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/>.
+ *
+ */
+
+namespace OCP\L10N;
+
+/**
+ * Interface ILanguageIterator
+ *
+ * iterator across 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"
+ * 3. returns the user language or:
+ * 4. if applicable, the trunk of 3
+ * 5. returns the system default language or:
+ * 6. if applicable, the trunk of 5
+ * 7+∞. returns 'en'
+ *
+ * if settings are not present or truncating is not applicable, the iterator
+ * skips to the next valid item itself
+ *
+ * @package OCP\L10N
+ *
+ * @since 14.0.0
+ */
+interface ILanguageIterator extends \Iterator {
+
+ /**
+ * Return the current element
+ *
+ * @since 14.0.0
+ */
+ public function current(): string;
+
+ /**
+ * Move forward to next element
+ *
+ * @since 14.0.0
+ */
+ public function next();
+
+ /**
+ * Return the key of the current element
+ *
+ * @since 14.0.0
+ */
+ public function key():int;
+
+ /**
+ * Checks if current position is valid
+ *
+ * @since 14.0.0
+ */
+ public function valid():bool;
+}