Use Laravel translator in translation string

Can I use it trans()

in a lang file?

For example: string Please fill in your :attribute

Let say :attribute

be the password.

Could put password

in an English lang file

and then use wachtwoord

in dutch lang file for :attribute

?

+3


source to share


1 answer


You can use language specific attributes for this inside the language check file lang/nl/validation.php

in an array attributes

, e.g .:

'attributes' => [
    'name' => 'naam'
    'password' => 'wachtwoord'
],

      



This will translate these attributes in all forms.

for a broader check explanation: Laravel's "nice names" validation attributes

+3


source







All Articles