Move locale code.

This commit is contained in:
James Cole 2016-01-08 20:47:35 +01:00
parent a3a1bc30b1
commit 84ce9bc94b

View File

@ -2,6 +2,7 @@
namespace FireflyIII\Http\Controllers; namespace FireflyIII\Http\Controllers;
use App;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
@ -36,6 +37,14 @@ class Controller extends BaseController
$this->monthFormat = trans('config.month'); $this->monthFormat = trans('config.month');
$this->monthAndDayFormat = trans('config.month_and_day'); $this->monthAndDayFormat = trans('config.month_and_day');
App::setLocale($lang);
Carbon::setLocale(substr($lang, 0, 2));
$locale = explode(',', trans('config.locale'));
$locale = array_map('trim', $locale);
setlocale(LC_TIME, $locale);
setlocale(LC_MONETARY, $locale);
View::share('monthFormat', $this->monthFormat); View::share('monthFormat', $this->monthFormat);
View::share('monthAndDayFormat', $this->monthAndDayFormat); View::share('monthAndDayFormat', $this->monthAndDayFormat);
View::share('language', $lang); View::share('language', $lang);