Merge branch 'master' into bugfix/unnecessary-joins-8614

This commit is contained in:
Eric Lippmann 2015-03-12 01:25:28 +01:00
commit 16c78c5cab
2 changed files with 12 additions and 8 deletions

View File

@ -21,7 +21,7 @@ if (! $this->auth()->isAuthenticated()) {
</li> </li>
</ul> </ul>
</div> </div>
<div id="menu" data-last-update="<?= (time() - 14) ?>000" data-base-target="_main" class="container" <div id="menu" data-last-update="-1" data-base-target="_main" class="container"
data-icinga-url="<?= $this->href('layout/menu') ?>" data-icinga-refresh="15"> data-icinga-url="<?= $this->href('layout/menu') ?>" data-icinga-refresh="15">
<?= $this->partial( <?= $this->partial(
'layout/menu.phtml', 'layout/menu.phtml',

View File

@ -307,20 +307,24 @@ class Web extends ApplicationBootstrap
/** /**
* Setup internationalization using gettext * 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() protected function detectLocale()
{ {
$auth = Manager::getInstance(); $auth = Manager::getInstance();
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$auth->isAuthenticated() if ($auth->isAuthenticated()
|| ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) === null && ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null
) { ) {
$locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']); return $locale;
} }
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
return $locale; return Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
return Translator::DEFAULT_LOCALE;
} }
/** /**