Laravel中标题的翻译不起作用

时间:2019-01-14 07:27:19

标签: laravel laravel-5 laravel-blade

我收到此通知(resources/views/vendor/notifications/email.blade.php):

@lang( "If you’re having trouble clicking the ":actionText" button, 
    copy and paste the URL below\n". 'into your web browser: 
    :actionURL', [ 'actionText' => $actionText, 'actionURL' => $actionUrl])

现在,我想在de.json目录中使用resource/lang翻译那个:

{ 
    "If you’re having trouble clicking the \":actionText\" button, 
    copy and paste the URL below into your web browser: [:actionURL] . 
    (:actionURL)": "Falls Du Probleme dabei hast, den \":actionText\" 
    Button anzuklicken, rufe folgende URL auf: [:actionURL](:actionURL)"
}

我以这种方式创建的所有其他翻译都工作正常。我该怎么解决?

3 个答案:

答案 0 :(得分:1)

只需删除串联点并将所有单词放在同一字符串中,如下所示:

[[1,1,1],[4],[2]]

答案 1 :(得分:0)

如果您使用laravel 6,7,请尝试删除“:actionURL” 示例:

"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser: ": "Falls Du Probleme dabei hast, den \":actionText\" Button anzuklicken,\nrufe folgende URL auf: "

答案 2 :(得分:0)

在laravel 6或更高版本中,您可以在lang.json文件中使用它:

"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "translation into your favorite language"

在邮件末尾无需使用['actionText' => $actionText,]