V
V
Vakha12019-03-14 22:42:00
Laravel
Vakha1, 2019-03-14 22:42:00

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

1 answer(s)
A
antimind, 2019-03-15
@Vakha1

And why did you decide that you can write a translation there? Translations live at resources/lang/ xx /validation.php , where xx is the name of the locale (eg ru for Russian).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question