mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Edit and set language [skip ci]
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Input;
|
||||
use Preferences;
|
||||
@@ -37,9 +38,11 @@ class PreferencesController extends Controller
|
||||
$viewRange = $viewRangePref->data;
|
||||
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
|
||||
$budgetMax = Preferences::get('budgetMaximum', 1000);
|
||||
$languagePref = Preferences::get('language', 'en');
|
||||
$language = $languagePref->data;
|
||||
$budgetMaximum = $budgetMax->data;
|
||||
|
||||
return view('preferences.index', compact('budgetMaximum', 'accounts', 'frontPageAccounts', 'viewRange'));
|
||||
return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,6 +68,12 @@ class PreferencesController extends Controller
|
||||
$budgetMaximum = intval(Input::get('budgetMaximum'));
|
||||
Preferences::set('budgetMaximum', $budgetMaximum);
|
||||
|
||||
// language:
|
||||
$lang = Input::get('language');
|
||||
if (in_array($lang, array_keys(Config::get('firefly.lang')))) {
|
||||
Preferences::set('language', $lang);
|
||||
}
|
||||
|
||||
|
||||
Session::flash('success', 'Preferences saved!');
|
||||
|
||||
|
Reference in New Issue
Block a user