How can I translate the password reset email in Laravel 5.7?

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

How to Translate the Password Reset Email in Laravel 5.7

As a senior developer working with Laravel, you frequently encounter the need for internationalization (i18n). While translating views is straightforward—using the resources/lang files—translating automated emails presents a slightly different challenge. The password reset email, being generated by the Mail system, requires a specific approach to ensure all dynamic and static text is localized correctly.

This guide will walk you through the most effective methods for translating your Laravel password reset email in an application running on Laravel 5.7, focusing on best practices for maintainability.

Understanding Laravel Localization in Emails

When building emails in Laravel, you are typically using Mailable classes. These classes contain the logic for constructing the email content, often pulling data from Eloquent models and using Blade templates to format the final output. The key to translation lies in ensuring that the strings used within these templates can be accessed via Laravel's localization functions.

The standard practice is to leverage the built-in localization features of the framework. You don't need a completely separate email system; you just need to correctly utilize the language files you already have established.

Step-by-Step Implementation for Translation

To successfully translate your password reset email, follow these steps:

1. Prepare Your Language Files

Ensure your language files are properly structured within the resources/lang directory. For example, if you are using the default English file (en), you would create a French file (fr).

File Structure Example:

resources/lang/
├── en/
│   └── mail.php  // Contains all English strings
└── fr/
    └── mail.php  // Contains all French translations

In your resources/lang/en/mail.php file, you would define the text:

<?php

return [
    'password_reset_subject' => 'Password Reset Request',
    'password_reset_body_welcome' => 'Hello, %name%! Please reset your password.',
    'password_reset_link' => 'Click here to reset your password.',
];

You would then translate these keys in resources/lang/fr/mail.php.

2. Injecting Translations into the Mailable

When you build your Mailable (e.g., ResetPasswordMail), you inject the translated strings directly into the view that renders the email. This ensures that whatever text is displayed is pulled dynamically based on the selected locale.

In your Mailable class, when loading the view, use the global __() helper or the trans() function to retrieve the localized string:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Support\Facades\Mail;

class ResetPasswordMail extends Mailable
{
    use Queueable;

    public $user;

    public function __construct($user)
    {
        $this->user = $user;
    }

    public function build()
    {
        // Pass the user data to the view
        return $this->view('emails.password_reset', [
            'user' => $this->user,
        ])
        // The Mailable system automatically handles loading the correct locale 
        // if configured correctly in your application setup.
        ->subject( __('mail.password_reset_subject') );
    }
}

3. Rendering the Email View

In your Blade file (resources/views/emails/password_reset.blade.php), you use the same localization syntax to display the translated content:

<h1>{{ __('mail.password_reset_body_welcome', ['name' => $user->name]) }}</h1>

<p>{{ __('mail.password_reset_link') }}</p>

<!-- ... rest of your email content -->

By using __('key'), Laravel automatically looks up the corresponding string in the currently active language file, making the entire process highly scalable and maintainable. This approach aligns perfectly with the modular design principles seen across the wider laravelcompany.com ecosystem, ensuring that our code remains clean and adaptable regardless of regional requirements.

Conclusion

Translating automated emails like password resets is not unique; it's simply applying the standard Laravel localization methodology to your Mailable templates. By defining all translatable strings in separate language files and using the __() helper within your Blade views, you achieve a robust system that is easy to manage, test, and expand for future internationalization needs. Focus on centralizing your text in the language files, and let Laravel handle the heavy lifting of localization.