All,
Is it possible to translate the field in model validation?
In the controller it can with :
Translation of message and validation labels
To use translated strings from language files, we can simply use the dot syntax. Let’s say we have a file with translations located here: app/Languages/en/Rules.php. We can simply use the language lines defined in this file, like this:
Code:
$validation->setRules([
'username' => [
'label' => 'Rules.username',
'rules' => 'required|is_unique[users.username]',
'errors' => [
'required' => 'Rules.username.required'
]
],
'password' => [
'label' => 'Rules.password',
'rules' => 'required|min_length[10]',
'errors' => [
'min_length' => 'Rules.password.min_length'
]
]
]
);
But in the documentation is no example for model validation.
André