Search code examples
phplaravellaravel-5translation

How do I correctly translate the activation email in Laravel 5.8?


How do I translate the activation email after registration (build Auth in Laravel)?

I've made this translation in pl/pl.json:

"If you’re having trouble clicking the": "Jeśli masz problem z kliknięciem", "button, copy and paste the URL below": " to skopiuj i wklej poniższy adres URL ", "into your web browser": " do przeglądarki internetowej"

but in mail I have this:

If you’re having trouble clicking the "Zweryfikuj adres email" button, copy and paste the URL below into your web browser: http://domain.test/email/verify/8?expires=1558113166&signature=2deea0aa937119efbf99ebbfc73bbf985f373491b47b0dcdfc76ee3b6dad6aeb

This is a mix of Polish and English. So I believe my translation is not working.


Solution

  • Judging by the contents of this file:

    https://github.com/laravel/framework/blob/5.8/src/Illuminate/Notifications/resources/views/email.blade.php

    I think you need a different translation:

    { "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser: [:actionURL](:actionURL)": "Jeśli masz problem z kliknięciem \":actionText\" to skopiuj i wklej poniższy adres URL do przeglądarki internetowej: [:actionURL](:actionURL)" }

    As for adding a logo, you can run

    php artisan vendor:publish --tag=laravel-notifications
    

    and the email.blade.php file should be added to resources/views/vendor/notifications.