I have a file of translations for email notifications, inside resources/lang
, which I have called es.json
. His list is as follows:
{
"Verify Your Email Address" : "Verifique su dirección de e-mail",
"Please click the button below to verify your email address." : "Pulse el botón que aparece a continuación para verificar su correo.",
"Verify Email Address" : "Verificar correo electrónico",
"If you did not create an account, no further action is required." : "Si usted no ha creado una cuenta, puede borrar este correo sin más.",
"Reset Password Notification" : "Restablecimiento de contraseña",
"You are receiving this email because we received a password reset request for your account." : "Ha recibido este correo porque ha solicitado restablececer la contraseña de su cuenta.",
"Reset Password" : "Restablecer contraseña",
"This password reset link will expire in :count minutes." : "Este enlace expirará en :count minutos.",
"If you did not request a password reset, no further action is required." : "Si no solicitó el restablecimiento de su contraseña, simplemente ignore este correo.",
"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser: [:actionURL](:actionURL)" : "Si tiene problemas usando el botón \":actionText\", copie y pegue la siguiente dirección en su navegador: [:actionURL](:actionURL)",
}
When I try to access the user registry, I get an exception like this:
Translation file [C:\laragon\www\prueba\resources\lang/es.json] contains an invalid JSON structure. (View: C:\laragon\www\prueba\resources\views\auth\register.blade.php)
The file is correctly formatted in JSON, as you can see above. Also, the view register.blade.php
doesn't even make use of that file. Instead, it uses a PHP translation file in path resources/lang/auth.register.php
, which appears below:
<?php
return [
// Vista del formulario de registro
'Register' => 'Registro',
'First Name' => 'Nombre',
'Surname' => 'Apellido(s)',
'Username' => 'Nombre de usuario',
'E-Mail Address' => 'Dirección de e-mail',
'Password' => 'Contraseña',
'Confirm Password' => 'Confirme contraseña',
// Vista de verificación de email
'Verify Your Email Address' => 'Verifique su dirección de e-mail',
'A fresh verification link has been sent to your email address.' => 'Se ha enviado un nuevo enlace de veridficación a su dirección de email.',
'Before proceeding, please check your email for a verification link.' => 'Antes de continuar, por favor, busque en el correo el enlace de verificación',
'If you did not receive the email' => 'Si no ha racibido el e-mail',
'click here to request another' => 'pulse aquí para que le enviemos otro',
];
Summarizing. The JSON file is for email notifications only. Why am I getting this exception?
The problem you are having is that your json string must not have a comma
,
in the last element.change this
To this: