Merge branch 'feature/include-check-if-chosen-locale-is-available-11820'

resolves #11820
This commit is contained in:
Eric Lippmann 2016-11-17 11:23:49 +01:00
commit 3d6e804ff3
2 changed files with 26 additions and 8 deletions

View File

@ -156,6 +156,16 @@ class PreferenceForm extends Form
*/
public function createElements(array $formData)
{
if (setlocale(LC_ALL, 0) === 'C') {
$this->warning(
$this->translate(
'Your language setting is not applied because your platform is missing the corresponding locale.'
. ' Make sure to install the correct language pack and restart your web server afterwards.'
),
false
);
}
if (! (bool) Config::app()->get('themes', 'disabled', false)) {
$themes = Icinga::app()->getThemes();
if (count($themes) > 1) {

View File

@ -1576,30 +1576,38 @@ class Form extends Zend_Form
}
/**
* Add a error notification and prevent the form from being successfully validated
* Add a error notification
*
* @param string|array $message The notification message
* @param bool $markAsError Whether to prevent the form from being successfully validated or not
*
* @return $this
*/
public function error($message)
public function error($message, $markAsError = true)
{
$this->addNotification($message, self::NOTIFICATION_ERROR);
if ($markAsError) {
$this->markAsError();
}
return $this;
}
/**
* Add a warning notification and prevent the form from being successfully validated
* Add a warning notification
*
* @param string|array $message The notification message
* @param bool $markAsError Whether to prevent the form from being successfully validated or not
*
* @return $this
*/
public function warning($message)
public function warning($message, $markAsError = true)
{
$this->addNotification($message, self::NOTIFICATION_WARNING);
if ($markAsError) {
$this->markAsError();
}
return $this;
}