Merge branch 'master' into bugfix/logout-external-8626
This commit is contained in:
commit
ac2522af20
|
@ -307,20 +307,24 @@ class Web extends ApplicationBootstrap
|
|||
/**
|
||||
* Setup internationalization using gettext
|
||||
*
|
||||
* Uses the preferred user language or the configured default and system default, respectively.
|
||||
* Uses the preferred user language or the browser suggested language or our default.
|
||||
*
|
||||
* @return self
|
||||
* @return string Detected locale code
|
||||
*
|
||||
* @see Translator::DEFAULT_LOCALE For the the default locale code.
|
||||
*/
|
||||
protected function detectLocale()
|
||||
{
|
||||
$auth = Manager::getInstance();
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$auth->isAuthenticated()
|
||||
|| ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) === null
|
||||
if ($auth->isAuthenticated()
|
||||
&& ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null
|
||||
) {
|
||||
$locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
return $locale;
|
||||
}
|
||||
|
||||
return $locale;
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
return Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
}
|
||||
return Translator::DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue