| | 475 | * Provides a generic interface to load the errors. Each field can have a |
| | 476 | * specific message, such as username.required, and a default message, such |
| | 477 | * as username.default. |
| | 478 | * |
| | 479 | * @param string language file to load errors from |
| | 480 | * @return void |
| | 481 | */ |
| | 482 | public function load_errors($file = 'forms') |
| | 483 | { |
| | 484 | foreach ($this->errors as $input => $error) |
| | 485 | { |
| | 486 | // Key for this input error |
| | 487 | $key = "$file.$input.$error"; |
| | 488 | |
| | 489 | if (($str = Kohana::lang($key)) === $key) |
| | 490 | { |
| | 491 | // Get the default error message |
| | 492 | $str = Kohana::lang("$file.$input.default"); |
| | 493 | } |
| | 494 | |
| | 495 | // Add the message |
| | 496 | $this->message($input, $str); |
| | 497 | } |
| | 498 | } |
| | 499 | |
| | 500 | /** |