0

如何翻译通知消息文本?我找到它的路径, /vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php' copied it's content to app/Notifications/PasswordReset.php`

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.'));
}

如何翻译Lang::get('Reset Password Notification')字符串,将我的翻译放在哪里,如何设置语言环境?

4

2 回答 2

1

您必须使用目录中的本地化文件resources/lang。文档中有很好的解释: Using Translation Strings As Keys

这行得通,但有更好的选择吗?

有一个不错的软件包可以轻松管理您的翻译: 翻译管理器

它提供了在项目文件中查找翻译的命令,还可以在本地化文件中附加新的翻译字符串,并提供简单的用户界面来设置不同语言的翻译。

于 2021-10-04T11:16:10.007 回答
0

Currently found that I create '{locale}.json'. I put strings in resources/lang/lt.json:

{
"Reset Password Notification": "Slaptažodžio priminimo pranešimas",
}

This works, but are any better options?

于 2021-10-04T11:05:04.400 回答