Translation of a Title in Laravel Doesn't Work

Viewed 839

I got this notification (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])

Now I'd like to translate that one using de.json in resource/lang-directory:

{ 
    "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)"
}

All other translations I created this way are working fine. How can I solve that?

3 Answers

Simply remove the concatenation dot and put all words in the same string, like this:

{

"If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser: [:actionURL](:actionURL)" : "Caso não seja possível clicar no botão \":actionText\", copie e cole no seu navegador o endereço a seguir: [:actionUrl](:actionUrl) \n",

}

If you use laravel 6,7 try remove ":actionURL" example:

"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: "

in laravel 6 or above, you can use this in lang.json file:

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

no need to use ['actionText' => $actionText,] at the end of message

Related