Ensure that all utilized form validators can be translated

refs #8415
This commit is contained in:
Johannes Meyer 2015-02-12 08:54:56 +01:00
parent 6c70a53309
commit c06f015210
2 changed files with 14 additions and 7 deletions

View File

@ -40,13 +40,22 @@ class ExternalBackendForm extends Form
array(
'pattern' => '/^[^\\[\\]:]+$/',
'messages' => array(
'regexNotMatch' => 'The backend name cannot contain \'[\', \']\' or \':\'.'
'regexNotMatch' => $this->translate(
'The backend name cannot contain \'[\', \']\' or \':\'.'
)
)
)
)
)
)
);
$callbackValidator = new Zend_Validate_Callback(function ($value) {
return @preg_match($value, '') !== false;
});
$callbackValidator->setMessage(
$this->translate('"%value%" is not a valid regular expression'),
Zend_Validate_Callback::INVALID_VALUE
);
$this->addElement(
'text',
'strip_username_regexp',
@ -56,11 +65,7 @@ class ExternalBackendForm extends Form
'The regular expression to use to strip specific parts off from usernames.'
. ' Leave empty if you do not want to strip off anything'
),
'validators' => array(
new Zend_Validate_Callback(function ($value) {
return @preg_match($value, '') !== false;
})
)
'validators' => array($callbackValidator)
)
);
$this->addElement(

View File

@ -74,7 +74,9 @@ class LoggingConfigForm extends Form
array(
'pattern' => '/^[^\W]+$/',
'messages' => array(
'regexNotMatch' => 'The application prefix cannot contain any whitespaces.'
'regexNotMatch' => $this->translate(
'The application prefix must not contain whitespace.'
)
)
)
)