【发布时间】:2025-12-22 01:10:10
【问题描述】:
我想将密码重置电子邮件翻译成 Laravel。 (对于前端我使用 Vue.js)
在config/app.php我已经设置了想要的语言
'locale' => 'sl',
'fallback_locale' => 'sl',
我从https://github.com/Laravel-Lang/lang 下载翻译并将下载的存储库中的文件夹“locales\sl”放入我的项目中的resources\lang\sl。
我使用自定义电子邮件通知 app\Notifications\ResetPasswordNotification.php 我添加了:
use Illuminate\Support\Facades\Lang;
我使用了翻译:
->line(Lang::get('You are receiving this email because we received a password reset request for your account.'))
这个翻译存储在resources\lang\sl\sl.json
现在发送电子邮件时,我没有收到任何错误,但电子邮件仍然是英文的,但假设 API 响应使用所需的语言。
{"status": "We have emailed your password reset link!"}
^^ 这个状态被翻译成config/app.php中指定的语言
我运行了这两行,但是没有效果...
php artisan config:clear
php artisan cache:clear
【问题讨论】: