| 250 | | // Strip 'valid_' from func name |
| 251 | | $func = (substr($func, 0, 6) === 'valid_') ? substr($func, 6) : $func; |
| 252 | | // Fetch an i18n error message |
| 253 | | $error = Kohana::lang('validation.'.$func, $args); |
| | 250 | // Get the proper i18n entry, very hacky but it works |
| | 251 | switch($func) |
| | 252 | { |
| | 253 | case 'valid_url': |
| | 254 | case 'valid_email': |
| | 255 | case 'valid_ip': |
| | 256 | // Fetch an i18n error message |
| | 257 | $error = Kohana::lang('validation.'.$func, $args); |
| | 258 | break; |
| | 259 | case substr($func, 0, 6) === 'valid_': |
| | 260 | // Strip 'valid_' from func name |
| | 261 | $func = (substr($func, 0, 6) === 'valid_') ? substr($func, 6) : $func; |
| | 262 | case 'alpha': |
| | 263 | case 'alpha_dash': |
| | 264 | case 'digit': |
| | 265 | case 'numeric': |
| | 266 | // i18n strings have to be inserted into valid_type |
| | 267 | $args[] = Kohana::lang('validation.'.$func); |
| | 268 | $error = Kohana::lang('validation.valid_type', $args); |
| | 269 | break; |
| | 270 | default: |
| | 271 | $error = Kohana::lang('validation.'.$func, $args); |
| | 272 | } |