added language support for characters and kilobytes in validator library.

This commit is contained in:
Taylor Otwell 2011-07-21 23:39:09 -05:00
parent c1ca97d9fb
commit d420d1c07f
2 changed files with 19 additions and 1 deletions

View File

@ -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 @@
"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",
);

View File

@ -431,7 +431,9 @@ protected function get_message($attribute, $rule)
// 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;