I have a command called SendReminders
, when I change the locale with App::setLocale('locale')
it looks like is working because when I do App::getLocale()
returns the correct one, but when I call for a translation returns always the default localization.
This is my SendReminders class:
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App;
use Exception;
use Storage;
use Lang;
class SendReminders extends Command
{
protected $signature = 'send:reminders';
public function __construct(){
parent::__construct();
}
public function handle(){
App::setLocale('EN');
echo App::getLocale()."\n"; // <= Shows correctly 'EN'
echo Lang::get('general.contact')."\n"; // <= Shows correctly 'Contact'
App::setLocale('DE');
echo App::getLocale()."\n"; // <= Shows correctly 'DE'
echo Lang::get('general.contact')."\n"; // <= Doesn't show the correct value
}
}
I'm missing something to make the localization work?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2A94ui7
via IFTTT
Aucun commentaire:
Enregistrer un commentaire