diff --git a/filesystem/Upload.php b/filesystem/Upload.php index 7af603fb2..549b12752 100644 --- a/filesystem/Upload.php +++ b/filesystem/Upload.php @@ -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) ); diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index 213150b8b..26dc86a9b 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -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 ); diff --git a/forms/CreditCardField.php b/forms/CreditCardField.php index 4174ffd32..9291b632f 100644 --- a/forms/CreditCardField.php +++ b/forms/CreditCardField.php @@ -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", diff --git a/forms/CurrencyField.php b/forms/CurrencyField.php index 9ef8c48dc..486d95f72 100644 --- a/forms/CurrencyField.php +++ b/forms/CurrencyField.php @@ -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; diff --git a/forms/DateField.php b/forms/DateField.php index 4d609abf9..4df3dec24 100644 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -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", diff --git a/forms/EmailField.php b/forms/EmailField.php index 28357de3a..1cd2c82aa 100644 --- a/forms/EmailField.php +++ b/forms/EmailField.php @@ -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; diff --git a/forms/RequiredFields.php b/forms/RequiredFields.php index c874c7971..a85377550 100644 --- a/forms/RequiredFields.php +++ b/forms/RequiredFields.php @@ -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; } diff --git a/forms/TableField.php b/forms/TableField.php index 07002ecac..969c22e18 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -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 ); diff --git a/forms/Validator.php b/forms/Validator.php index 4194f21f4..0bf4ed81e 100644 --- a/forms/Validator.php +++ b/forms/Validator.php @@ -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"); } /** diff --git a/lang/en.yml b/lang/en.yml index 55724b51e..5dae0af43 100644 --- a/lang/en.yml +++ b/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: diff --git a/lang/en_GB.yml b/lang/en_GB.yml index b51ebc87d..5d0d5663b 100644 --- a/lang/en_GB.yml +++ b/lang/en_GB.yml @@ -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: diff --git a/tests/filesystem/UploadTest.php b/tests/filesystem/UploadTest.php index d3f112384..6eb3d517b 100644 --- a/tests/filesystem/UploadTest.php +++ b/tests/filesystem/UploadTest.php @@ -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) ); diff --git a/tests/forms/FormTest.php b/tests/forms/FormTest.php index 61acf536f..c848a1d05 100644 --- a/tests/forms/FormTest.php +++ b/tests/forms/FormTest.php @@ -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' );