DEV Community

Bert Heyman
Bert Heyman

Posted on • Edited on

How to translate the Laravel password reset email

Laravel offers a very convenient default email to reset your password (via Laravel Breeze).
If you're building an application targetted at another language than English, you'll need to customize it.
I'm sharing an example, since the way to do this isn't always obvious.

Preparation

If you didn't do this yet, change the locale setting in config > app.php.
This will affect what translations Laravel looks for.

How to

In resources > lang, create a new file like nl.json (change nl by your language).
In that json, you can map the text from the password reset email to a translated version.

Dutch translation

To get you started, here is a Dutch example:

{
    "Hello!": "Hallo",
    "Reset Password Notification": "Wachtwoord reset",
    "You are receiving this email because we received a password reset request for your account.": "Je krijgt deze email na een verzoek om je wachtwoord opnieuw in te stellen.",
    "Reset Password": "Reset wachtwoord",
    "This password reset link will expire in :count minutes.": "De link blijft :count minuten geldig.",
    "Regards": "Groeten",
    "If you did not request a password reset, no further action is required.": "Als je deze aanvraag niet zelf hebt gedaan, mag je deze mail negeren.",
    "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Als de \":actionText\" knop niet werkt, kan je ook deze link copy-pasten: ",
    "All rights reserved.": "Alle rechten voorbehouden."
}
Enter fullscreen mode Exit fullscreen mode

Hope this saves you some time!

Top comments (1)

Collapse
 
parriondo profile image
Pedro Arriondo

Thanks!!!!!!!