Edit and set language [skip ci]

This commit is contained in:
James Cole 2015-05-14 09:59:30 +02:00
parent 392c1fc399
commit 9f99e7c0af
2 changed files with 15 additions and 2 deletions

View File

@ -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!');

View File

@ -95,7 +95,11 @@
{% for key, lang in Config.get('firefly.lang') %}
<div class="radio">
<label>
<input type="radio" name="language" value="{{ key }}" />
<input type="radio" name="language" value="{{ key }}"
{% if language == key %}
checked
{% endif %}
/>
{{ lang }}
</label>
</div>