Ali Erfani
Ali Erfani

Reputation: 692

Laravel 5.1 How to translate attribute values in the form validation messages?

I need to translate the attribute values for the form validations. So I have duplicated the English validation errors and translated them to Farsi. Everything works but the attribute values are still in English. I thought I need to put the translation of attributes in the attributes array in the validation file as follows, but it's not working.

'attributes' => [
        'username '=>'نام کاربری'
    ],

How can I translate them?

Upvotes: 1

Views: 1184

Answers (1)

tuscan88
tuscan88

Reputation: 5839

You have a space after username before the quote so the attribute key is different. Remove the space so that it is the same.

Upvotes: 2

Related Questions