summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib/Settings/Admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/updatenotification/lib/Settings/Admin.php')
-rw-r--r--apps/updatenotification/lib/Settings/Admin.php33
1 files changed, 6 insertions, 27 deletions
diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php
index b859ca79f62..cae62ee0a9f 100644
--- a/apps/updatenotification/lib/Settings/Admin.php
+++ b/apps/updatenotification/lib/Settings/Admin.php
@@ -123,39 +123,18 @@ class Admin implements ISettings {
return $filtered;
}
- $isFirstCall = true;
+ $iterator = $this->l10nFactory->getLanguageIterator();
do {
- $lang = $this->l10nFactory->iterateLanguage($isFirstCall);
- if($this->findWhatsNewTranslation($lang, $filtered, $changes['whatsNew'])) {
- return $filtered;
+ $lang = $iterator->current();
+ if(isset($changes['whatsNew'][$lang])) {
+ return $filtered['whatsNew'][$lang];
}
- $isFirstCall = false;
- } while($lang !== 'en');
+ $iterator->next();
+ } while($lang !== 'en' && $iterator->valid());
return $filtered;
}
- protected function getLangTrunk(string $lang):string {
- $pos = strpos($lang, '_');
- if($pos !== false) {
- $lang = substr($lang, 0, $pos);
- }
- return $lang;
- }
-
- protected function findWhatsNewTranslation(string $lang, array &$result, array $whatsNew): bool {
- if(isset($whatsNew[$lang])) {
- $result['whatsNew'] = $whatsNew[$lang];
- return true;
- }
- $trunkedLang = $this->getLangTrunk($lang);
- if($trunkedLang !== $lang && isset($whatsNew[$trunkedLang])) {
- $result['whatsNew'] = $whatsNew[$trunkedLang];
- return true;
- }
- return false;
- }
-
/**
* @param array $groupIds
* @return array