#How to localize password reset email in Laravel 11

2 messages · Page 1 of 1 (latest)

unreal wedge
#

Looking for a way to localize the strings used in the password reset email for Laravel 11.

I see the strings are defined in vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php like so:

protected function buildMailMessage($url)
    {
        return (new MailMessage)
            ->subject(Lang::get('Reset Password Notification'))
            ->line(Lang::get('You are receiving this email because we received a password reset request for your account.'))
            ->action(Lang::get('Reset Password'), $url)
            ->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')]))
            ->line(Lang::get('If you did not request a password reset, no further action is required.'));
    }

I have trouble believing I can't simply define translations for these strings in my lang/[locale]/passwords.php file, although I'd need to know the keys for each line and the internet is failing me. Claude and chatGPT either suggest a custom notification, or hallucinate.

But in any case, I'm looking for a way to localize these strings without having to create a custom password reset notification. Anybody have any idea how to accomplish this? I've been investigating the subject on and off for weeks, but now I can't delay any further. If you can clarify how this Lang::get() method works too, that would be wonderful, as the api documentation doesn't offer a description. Thank you very much for any help you can provide.

prisma fox