I am creating an application in Laravel and I am stuck on the translate part
I have a form field that looks like this:
{!! Form::password('password') !!}
When a user leaves the field blank I get the error:
The password field is required
This would be correct for the english version.
But when I change my application to dutch I want to see
Het wachtwoord veld is verplicht
I already added this to the translation file but as this sentece will be used for every field like for example username and email aswell it uses the name of the field
So now I get the message 'Het password veld is verplicht' instead of 'Het wachtwoord veld is verplicht'
I know that I should not change the name of the input field as my controller expects the password field to have the name password
This is the code that creates the user as you can see it uses $data->password
public function createUser($data)
{
/* store the users email in variable */
$email = $data->email;
/* Creates a new user in the database with the filled in email and password */
$this->create([
'email' => $email,
'password' => \Hash::make($data->password)
]);
}
My question is how can I get the name of the field in the requested language?
So I still want to be able to user $data->password
but I also want to see the field name in the correct language.
Does anyone have an idea of how this can be done?
Note I know how to use the translate options in laravel I dont want any answers like:
To translate in blade use @lang('translatefile.name')