Answer the question
In order to leave comments, you need to log in
Question about errors in laravel, how to do the translation correctly?
Hello. Tell me how to solve the problem?
In the folder resource -> en - there is a validation.php file
. It contains an array of errors in English, and just below the custom array in which you can write the translation of these errors. That's exactly what I did.
"*"=>[
'alpha' => "Only letters are allowed",
'max' => [
'numeric' => ':attribute cannot be greater than :max.',
'file' => ':attribute cannot be be greater than :max kilobytes.',
'string' => ':attribute cannot be greater than :max characters.',
'array' => ':attribute can contain no more than :max elements.',
],
Then for alpha the translation works, and for max - the error is displayed in English.
How to do it right?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question