From d420d1c07f9d620e1c9945b94616465d6a578166 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 21 Jul 2011 23:39:09 -0500 Subject: [PATCH] added language support for characters and kilobytes in validator library. --- application/lang/en/validation.php | 16 ++++++++++++++++ system/validator.php | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/application/lang/en/validation.php b/application/lang/en/validation.php index 46a72f4d..44fc1a99 100644 --- a/application/lang/en/validation.php +++ b/application/lang/en/validation.php @@ -2,6 +2,12 @@ return array( + /* + |-------------------------------------------------------------------------- + | Validation Error Messages + |-------------------------------------------------------------------------- + */ + "accepted" => "The :attribute must be accepted.", "active_url" => "The :attribute does not exist.", "alpha" => "The :attribute may only contain letters.", @@ -23,4 +29,14 @@ return array( "unique" => "The :attribute has already been taken.", "url" => "The :attribute format is invalid.", + /* + |-------------------------------------------------------------------------- + | The following words are appended to the "size" messages when applicable, + | such as when validating string lengths or the size of file uploads. + |-------------------------------------------------------------------------- + */ + + "characters" => "characters", + "kilobytes" => "kilobytes", + ); \ No newline at end of file diff --git a/system/validator.php b/system/validator.php index 8ab618f0..f92a1ce8 100644 --- a/system/validator.php +++ b/system/validator.php @@ -431,7 +431,9 @@ class Validator { // the default error message appropriately. if (in_array($rule, $this->size_rules) and ! is_numeric($this->attributes[$attribute])) { - return (array_key_exists($attribute, $_FILES)) ? rtrim($message, '.').' kilobytes.' : rtrim($message, '.').' characters.'; + return (array_key_exists($attribute, $_FILES)) + ? rtrim($message, '.').' '.Lang::line('validation.kilobytes')->get().'.' + : rtrim($message, '.').' '.Lang::line('validation.characters')->get().'.'; } return $message;