mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Removing "." from the end of validation messages
This commit is contained in:
parent
7fe0858be1
commit
5462cdaab2
@ -498,7 +498,7 @@ class Upload_Validator {
|
||||
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
||||
$this->errors[] = _t(
|
||||
'File.TOOLARGE',
|
||||
'Filesize is too large, maximum {size} allowed.',
|
||||
'Filesize is too large, maximum {size} allowed',
|
||||
'Argument 1: Filesize (e.g. 1MB)',
|
||||
array('size' => $arg)
|
||||
);
|
||||
|
@ -280,7 +280,7 @@ class ConfirmedPasswordField extends FormField {
|
||||
if(!preg_match('/^(([a-zA-Z]+\d+)|(\d+[a-zA-Z]+))[a-zA-Z0-9]*$/',$value)) {
|
||||
$validator->validationError(
|
||||
'Password',
|
||||
_t('Form.VALIDATIONSTRONGPASSWORD', "Passwords must have at least one digit and one alphanumeric character."),
|
||||
_t('Form.VALIDATIONSTRONGPASSWORD', "Passwords must have at least one digit and one alphanumeric character"),
|
||||
"validation",
|
||||
false
|
||||
);
|
||||
|
@ -53,7 +53,7 @@ class CreditCardField extends TextField {
|
||||
$this->name,
|
||||
_t(
|
||||
'Form.VALIDATIONCREDITNUMBER',
|
||||
"Please ensure you have entered the {number} credit card number correctly.",
|
||||
"Please ensure you have entered the {number} credit card number correctly",
|
||||
array('number' => $number)
|
||||
),
|
||||
"validation",
|
||||
|
@ -44,7 +44,7 @@ class CurrencyField extends TextField {
|
||||
|
||||
function validate($validator) {
|
||||
if(!empty ($this->value) && !preg_match('/^\s*(\-?\$?|\$\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/', $this->value)) {
|
||||
$validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency."), "validation", false);
|
||||
$validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency"), "validation", false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -311,7 +311,7 @@ class DateField extends TextField {
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
_t(
|
||||
'DateField.VALIDDATEFORMAT2', "Please enter a valid date format ({format}).",
|
||||
'DateField.VALIDDATEFORMAT2', "Please enter a valid date format ({format})",
|
||||
array('format' => $this->getConfig('dateformat'))
|
||||
),
|
||||
"validation",
|
||||
|
@ -39,7 +39,7 @@ class EmailField extends TextField {
|
||||
if($this->value && !preg_match('/' . $pregSafePattern . '/i', $this->value)){
|
||||
$validator->validationError(
|
||||
$this->name,
|
||||
_t('EmailField.VALIDATION', "Please enter an email address."),
|
||||
_t('EmailField.VALIDATION', "Please enter an email address"),
|
||||
"validation"
|
||||
);
|
||||
return false;
|
||||
|
@ -85,7 +85,7 @@ class RequiredFields extends Validator {
|
||||
}
|
||||
|
||||
if($formField && $error) {
|
||||
$errorMessage = sprintf(_t('Form.FIELDISREQUIRED', '%s is required').'.', strip_tags('"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'));
|
||||
$errorMessage = sprintf(_t('Form.FIELDISREQUIRED', '%s is required'), strip_tags('"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'));
|
||||
if($msg = $formField->getCustomValidationMessage()) {
|
||||
$errorMessage = $msg;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ class TableField extends TableListField {
|
||||
if(!trim($fieldObj->Value())){
|
||||
$title = $fieldObj->Title();
|
||||
$errorMessage .= sprintf(
|
||||
_t('TableField.ISREQUIRED', "In %s '%s' is required."),
|
||||
_t('TableField.ISREQUIRED', "In %s '%s' is required"),
|
||||
$this->name,
|
||||
$title
|
||||
);
|
||||
|
@ -103,10 +103,10 @@ abstract class Validator extends Object {
|
||||
function requireField($fieldName, $data) {
|
||||
if(is_array($data[$fieldName]) && count($data[$fieldName])) {
|
||||
foreach($data[$fieldName] as $componentkey => $componentVal){
|
||||
if(!strlen($componentVal)) $this->validationError($fieldName, "$fieldName $componentkey is required.", "required");
|
||||
if(!strlen($componentVal)) $this->validationError($fieldName, "$fieldName $componentkey is required", "required");
|
||||
}
|
||||
|
||||
}else if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required.", "required");
|
||||
}else if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required", "required");
|
||||
}
|
||||
|
||||
/**
|
||||
|
14
lang/en.yml
14
lang/en.yml
@ -122,7 +122,7 @@ en:
|
||||
DateField:
|
||||
NOTSET: 'not set'
|
||||
TODAY: today
|
||||
VALIDDATEFORMAT2: 'Please enter a valid date format ({format}).'
|
||||
VALIDDATEFORMAT2: 'Please enter a valid date format ({format})'
|
||||
VALIDDATEMAXDATE: 'Your date has to be older or matching the maximum allowed date ({date})'
|
||||
VALIDDATEMINDATE: 'Your date has to be newer or matching the minimum allowed date ({date})'
|
||||
Director:
|
||||
@ -130,7 +130,7 @@ en:
|
||||
DropdownField:
|
||||
CHOOSE: (Choose)
|
||||
EmailField:
|
||||
VALIDATION: 'Please enter an email address.'
|
||||
VALIDATION: 'Please enter an email address'
|
||||
Email_BounceRecord:
|
||||
PLURALNAME: 'Email Bounce Records'
|
||||
SINGULARNAME: 'Email Bounce Record'
|
||||
@ -146,7 +146,7 @@ en:
|
||||
Name: Name
|
||||
PLURALNAME: Files
|
||||
SINGULARNAME: File
|
||||
TOOLARGE: 'Filesize is too large, maximum {size} allowed.'
|
||||
TOOLARGE: 'Filesize is too large, maximum {size} allowed'
|
||||
TOOLARGESHORT: 'Filesize exceeds {size}'
|
||||
Title: Title
|
||||
FileIFrameField:
|
||||
@ -170,13 +170,13 @@ en:
|
||||
TEXT3: for
|
||||
Form:
|
||||
FIELDISREQUIRED: '%s is required'
|
||||
VALIDATIONCREDITNUMBER: 'Please ensure you have entered the {number} credit card number correctly.'
|
||||
VALIDATIONCREDITNUMBER: 'Please ensure you have entered the {number} credit card number correctly'
|
||||
VALIDATIONNOTUNIQUE: 'The value entered is not unique'
|
||||
VALIDATIONPASSWORDSDONTMATCH: 'Passwords don''t match'
|
||||
VALIDATIONPASSWORDSNOTEMPTY: 'Passwords can''t be empty'
|
||||
VALIDATIONSTRONGPASSWORD: 'Passwords must have at least one digit and one alphanumeric character.'
|
||||
VALIDATIONSTRONGPASSWORD: 'Passwords must have at least one digit and one alphanumeric character'
|
||||
VALIDATOR: Validator
|
||||
VALIDCURRENCY: 'Please enter a valid currency.'
|
||||
VALIDCURRENCY: 'Please enter a valid currency'
|
||||
FormField:
|
||||
NONE: none
|
||||
GridAction:
|
||||
@ -455,7 +455,7 @@ en:
|
||||
SiteTree:
|
||||
TABMAIN: Main
|
||||
TableField:
|
||||
ISREQUIRED: 'In %s ''%s'' is required.'
|
||||
ISREQUIRED: 'In %s ''%s'' is required'
|
||||
TableField.ss:
|
||||
ADD: 'Add a new row'
|
||||
TableListField:
|
||||
|
@ -98,7 +98,7 @@ en_GB:
|
||||
DropdownField:
|
||||
CHOOSE: "(Choose)"
|
||||
EmailField:
|
||||
VALIDATION: "Please enter an email address."
|
||||
VALIDATION: "Please enter an email address"
|
||||
File:
|
||||
Content: "Content"
|
||||
Filename: "Filename"
|
||||
@ -107,7 +107,7 @@ en_GB:
|
||||
Name: "Name"
|
||||
PLURALNAME: "Files"
|
||||
SINGULARNAME: "File"
|
||||
TOOLARGE: "Filesize is too large; maximum %s is allowed."
|
||||
TOOLARGE: "Filesize is too large; maximum %s is allowed"
|
||||
Title: "Title"
|
||||
ForgotPasswordEmail.ss:
|
||||
HELLO: "Hello"
|
||||
@ -115,15 +115,15 @@ en_GB:
|
||||
TEXT2: "password reset link"
|
||||
TEXT3: "for"
|
||||
Form:
|
||||
FIELDISREQUIRED: "%s is required."
|
||||
VALIDATIONCREDITNUMBER: "Please ensure you have entered the %s credit card number correctly."
|
||||
FIELDISREQUIRED: "%s is required"
|
||||
VALIDATIONCREDITNUMBER: "Please ensure you have entered the %s credit card number correctly"
|
||||
VALIDATIONFAILED: "Validation failed"
|
||||
VALIDATIONNOTUNIQUE: "The value entered is not unique"
|
||||
VALIDATIONPASSWORDSDONTMATCH: "Passwords don't match"
|
||||
VALIDATIONPASSWORDSNOTEMPTY: "Passwords can't be empty"
|
||||
VALIDATIONSTRONGPASSWORD: "Passwords must have at least one digit and one alphanumeric character."
|
||||
VALIDATIONSTRONGPASSWORD: "Passwords must have at least one digit and one alphanumeric character"
|
||||
VALIDATOR: "Validator"
|
||||
VALIDCURRENCY: "Please enter a valid currency."
|
||||
VALIDCURRENCY: "Please enter a valid currency"
|
||||
FormField:
|
||||
NONE: "none"
|
||||
Group:
|
||||
@ -265,7 +265,7 @@ en_GB:
|
||||
SiteTree:
|
||||
TABMAIN: "Main"
|
||||
TableField:
|
||||
ISREQUIRED: "In %s '%s' is required."
|
||||
ISREQUIRED: "In %s '%s' is required"
|
||||
TableField.ss:
|
||||
ADD: "Add a new row"
|
||||
TableListField:
|
||||
|
@ -335,7 +335,7 @@ class UploadTest_Validator extends Upload_Validator implements TestOnly {
|
||||
$arg = File::format_size($this->getAllowedMaxFileSize($ext));
|
||||
$this->errors[] = _t(
|
||||
'File.TOOLARGE',
|
||||
'Filesize is too large, maximum {size} allowed.',
|
||||
'Filesize is too large, maximum {size} allowed',
|
||||
'Argument 1: Filesize (e.g. 1MB)',
|
||||
array('size' => $arg)
|
||||
);
|
||||
|
@ -204,14 +204,14 @@ class FormTest extends FunctionalTest {
|
||||
$this->assertPartialMatchBySelector(
|
||||
'#Email span.message',
|
||||
array(
|
||||
_t('EmailField.VALIDATION', "Please enter an email address.")
|
||||
'Please enter an email address'
|
||||
),
|
||||
'Formfield validation shows note on field if invalid'
|
||||
);
|
||||
$this->assertPartialMatchBySelector(
|
||||
'#SomeRequiredField span.required',
|
||||
array(
|
||||
sprintf(_t('Form.FIELDISREQUIRED').'.','"SomeRequiredField"')
|
||||
'"SomeRequiredField" is required'
|
||||
),
|
||||
'Required fields show a notification on field when left blank'
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user