Forum

Kohana: how to tran...
 
Notifications
Clear all

Kohana: how to translate validation errors

1 Posty
1 Users
0 Likes
469 Widok
0
Topic starter

example

1 Answer
0
Topic starter

example method

    function action_add()
    {
        if ($this->request->post()) {
            try {
                $user = new Model_User();
                $user->values($this->request->post());
                $user->save();
            } catch (ORM_Validation_Exception  $exception) {
                $this->setError($exception->errors( 'models'));
            }
        }
    }

put this file inside application/messages/models/user.php

<?php defined('SYSPATH') OR die('No direct access allowed.');

return array(
    'username' => array(
        'not_empty' => 'musisz podać login',
    ),
    'email' => array(
        'not_empty' => 'e-mail nie może być pusty',
        'email' => 'Podany adres e-mail nie jest poprawny. Sprawdź czy jest we własciwej formie.',
        'max_length' => 'Hasło nie może być dłuższe niż :param2 znaków',
        'not_like_login' => 'Hasło nie może być takie same jak login'
    ),
);

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: