DEV Community

Bert Heyman
Bert Heyman

Posted on • Edited on

6

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!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (3)

Collapse
 
parriondo profile image
Pedro Arriondo

Thanks!!!!!!!

Collapse
 
bertheyman profile image
Bert Heyman

Happy to hear it proved useful!

Collapse
 
junsbourne profile image
Junsbourne

I created an account just to thank you

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay