Laravel-excel: [QUESTION] i18n 'There was an error on row :row. :message'

Created on 6 Mar 2019  路  2Comments  路  Source: Maatwebsite/Laravel-Excel

Prerequisites

Versions

  • PHP version: 7+
  • Laravel version: 5.8+
  • Package version: 3.1

Description

Hello, I need to translate this line when doing row validation: 'There was an error on row :row. :message' (Laravel-Excel/src/Validators/Failure.php)

Do I need to override the function toArray()?

Using customValidationMessages() only affects :message.

Most helpful comment

I think you can just add "There was an error on row :row. :message": "Your translation" to your json translate file (https://laravel.com/docs/5.8/localization#using-translation-strings-as-keys)

All 2 comments

I think you can just add "There was an error on row :row. :message": "Your translation" to your json translate file (https://laravel.com/docs/5.8/localization#using-translation-strings-as-keys)

Ok, currently I have a validation.php file for all laravel validation messages inside resources/lang/my_lang/:

'required' => 'El campo :attribute es obligatorio.'

and a my_lang.json file for custom strings:

"There was an error on row :row. :message": "Hubo un error en la fila :row. :message"

Now using rule 'name' => ['required', 'string', 'max:255'], outputs: Hubo un error en la fila 2. El campo email es obligatorio.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings