Skip to content

Commit

Permalink
MINOR Removing "." from the end of validation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Harvey committed Jun 1, 2012
1 parent 7fe0858 commit 5462cda
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion filesystem/Upload.php
Expand Up @@ -498,7 +498,7 @@ public function validate() {
$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)
);
Expand Down
2 changes: 1 addition & 1 deletion forms/ConfirmedPasswordField.php
Expand Up @@ -280,7 +280,7 @@ function validate($validator) {
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
);
Expand Down
2 changes: 1 addition & 1 deletion forms/CreditCardField.php
Expand Up @@ -53,7 +53,7 @@ function validate($validator){
$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",
Expand Down
2 changes: 1 addition & 1 deletion forms/CurrencyField.php
Expand Up @@ -44,7 +44,7 @@ function performReadonlyTransformation() {

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;
Expand Down
2 changes: 1 addition & 1 deletion forms/DateField.php
Expand Up @@ -311,7 +311,7 @@ function validate($validator) {
$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",
Expand Down
2 changes: 1 addition & 1 deletion forms/EmailField.php
Expand Up @@ -39,7 +39,7 @@ function validate($validator) {
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;
Expand Down
2 changes: 1 addition & 1 deletion forms/RequiredFields.php
Expand Up @@ -85,7 +85,7 @@ function php($data) {
}

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;
}
Expand Down
2 changes: 1 addition & 1 deletion forms/TableField.php
Expand Up @@ -521,7 +521,7 @@ function validate($validator) {
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
);
Expand Down
4 changes: 2 additions & 2 deletions forms/Validator.php
Expand Up @@ -103,10 +103,10 @@ function getErrors() {
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");
}

/**
Expand Down
14 changes: 7 additions & 7 deletions lang/en.yml
Expand Up @@ -122,15 +122,15 @@ 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:
INVALID_REQUEST: 'Invalid request'
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'
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 7 additions & 7 deletions lang/en_GB.yml
Expand Up @@ -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"
Expand All @@ -107,23 +107,23 @@ 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"
TEXT1: "Here is your"
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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/filesystem/UploadTest.php
Expand Up @@ -335,7 +335,7 @@ public function validate() {
$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)
);
Expand Down
4 changes: 2 additions & 2 deletions tests/forms/FormTest.php
Expand Up @@ -204,14 +204,14 @@ function testSessionValidationMessage() {
$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'
);
Expand Down

0 comments on commit 5462cda

Please sign in to comment.