Reputation: 294
I want to translate password reset emails into Laravel. (for frontend I use Vue.js)
in config/app.php
I have set the desired language
'locale' => 'sl',
'fallback_locale' => 'sl',
than I downloaded translations from https://github.com/Laravel-Lang/lang and put folder "locales\sl" in downloaded repository into resources\lang\sl
in my project.
I use custom email notification app\Notifications\ResetPasswordNotification.php
where I added:
use Illuminate\Support\Facades\Lang;
and for translating I used:
->line(Lang::get('You are receiving this email because we received a password reset request for your account.'))
This translation is stored in resources\lang\sl\sl.json
Now when the email is sent I get no errors but the email is still in English, but let's say API responses are in the desired language.
{"status": "We have emailed your password reset link!"}
^^ this status gets translated into the language specified in config/app.php
I run these two lines, but no effect...
php artisan config:clear
php artisan cache:clear
Upvotes: 1
Views: 918
Reputation: 294
I managed to solve this.
I moved sl.json form resources\lang\sl\sl.json
into resources\lang\sl.json
:)
Upvotes: 2