Skip to content
Snippets Groups Projects
Commit 6fadb5a1 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Prevent notices/warnings when no priorities set for current lang

parent 7ec88a80
No related branches found
No related tags found
No related merge requests found
...@@ -536,14 +536,16 @@ class Translate ...@@ -536,14 +536,16 @@ class Translate
// we don't have a translation for the current language, load alternative priorities // we don't have a translation for the current language, load alternative priorities
$sspcfg = \SimpleSAML\Configuration::getInstance(); $sspcfg = \SimpleSAML\Configuration::getInstance();
$langcfg = $sspcfg->getConfigItem('language', null); $langcfg = $sspcfg->getConfigItem('language', null);
$priorities = array(); $priorities = [];
if ($langcfg instanceof \SimpleSAML\Configuration) { if ($langcfg instanceof \SimpleSAML\Configuration) {
$priorities = $langcfg->getArray('priorities', array()); $priorities = $langcfg->getArray('priorities', array());
} }
foreach ($priorities[$context['currentLanguage']] as $lang) { if ( !empty($priorities[$context['currentLanguage']]) ) {
if (isset($translations[$lang])) { foreach ($priorities[$context['currentLanguage']] as $lang) {
return $translations[$lang]; if (isset($translations[$lang])) {
return $translations[$lang];
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment