Replaced some language calls.

This commit is contained in:
James Cole
2015-12-24 08:35:08 +01:00
parent 7069e242ae
commit a6d71988f2
13 changed files with 56 additions and 45 deletions

View File

@@ -2,6 +2,7 @@ APP_ENV=production
APP_DEBUG=false APP_DEBUG=false
APP_KEY=SomeRandomStringOf32CharsExactly APP_KEY=SomeRandomStringOf32CharsExactly
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=localhost DB_HOST=localhost
DB_DATABASE=homestead DB_DATABASE=homestead
@@ -20,6 +21,8 @@ EMAIL_USERNAME=
EMAIL_PASSWORD= EMAIL_PASSWORD=
EMAIL_PRETEND=false EMAIL_PRETEND=false
SHOW_INCOMPLETE_TRANSLATIONS=false
ANALYTICS_ID= ANALYTICS_ID=
RUNCLEANUP=true RUNCLEANUP=true
SITE_OWNER=mail@example.com SITE_OWNER=mail@example.com

View File

@@ -105,8 +105,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
public function frontpage(Collection $accounts, Carbon $start, Carbon $end) public function frontpage(Collection $accounts, Carbon $start, Carbon $end)
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month_and_day');
$format = Config::get('firefly.monthAndDay.' . $language);
$data = [ $data = [
'count' => 0, 'count' => 0,
'labels' => [], 'labels' => [],
@@ -151,8 +150,7 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
public function single(Account $account, Carbon $start, Carbon $end) public function single(Account $account, Carbon $start, Carbon $end)
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month_and_day');
$format = Config::get('firefly.monthAndDay.' . $language);
$data = [ $data = [
'count' => 1, 'count' => 1,

View File

@@ -71,8 +71,7 @@ class ChartJsBillChartGenerator implements BillChartGenerator
public function single(Bill $bill, Collection $entries) public function single(Bill $bill, Collection $entries)
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month');
$format = Config::get('firefly.month.' . $language);
$data = [ $data = [
'count' => 3, 'count' => 3,

View File

@@ -24,7 +24,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
public function budget(Collection $entries, $dateFormat = 'month') public function budget(Collection $entries, $dateFormat = 'month')
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$format = Config::get('firefly.' . $dateFormat . '.' . $language); $format = Config::get('firefly.' . $dateFormat . '.' . $language);
$data = [ $data = [
@@ -33,7 +33,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
[ [
'label' => 'Amount', 'label' => 'Amount',
'data' => [], 'data' => [],
] ],
], ],
]; ];
@@ -115,8 +115,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
public function year(Collection $budgets, Collection $entries) public function year(Collection $budgets, Collection $entries)
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month');
$format = Config::get('firefly.month.' . $language);
$data = [ $data = [
'labels' => [], 'labels' => [],

View File

@@ -101,8 +101,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month');
$format = Config::get('firefly.month.' . $language);
$data = [ $data = [
'count' => 0, 'count' => 0,
@@ -135,8 +134,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month');
$format = Config::get('firefly.month.' . $language);
$data = [ $data = [
'count' => 0, 'count' => 0,

View File

@@ -25,8 +25,7 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGenerator
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month_and_day');
$format = Config::get('firefly.monthAndDay.' . $language);
$data = [ $data = [
'count' => 1, 'count' => 1,

View File

@@ -22,8 +22,7 @@ class ChartJsReportChartGenerator implements ReportChartGenerator
public function yearInOut(Collection $entries) public function yearInOut(Collection $entries)
{ {
// language: // language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $format = trans('config.month');
$format = Config::get('firefly.month.' . $language);
$data = [ $data = [
'count' => 2, 'count' => 2,

View File

@@ -36,8 +36,8 @@ abstract class Controller extends BaseController
if (Auth::check()) { if (Auth::check()) {
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US')); $pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
$lang = $pref->data; $lang = $pref->data;
$this->monthFormat = Config::get('firefly.month.' . $lang); $this->monthFormat = trans('config.month');
$this->monthAndDayFormat = Config::get('firefly.monthAndDay.' . $lang); $this->monthAndDayFormat = trans('config.month_and_day');
View::share('monthFormat', $this->monthFormat); View::share('monthFormat', $this->monthFormat);
View::share('monthAndDayFormat', $this->monthAndDayFormat); View::share('monthAndDayFormat', $this->monthAndDayFormat);

View File

@@ -37,10 +37,12 @@ class PreferencesController extends Controller
$viewRange = $viewRangePref->data; $viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []); $frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000); $budgetMax = Preferences::get('budgetMaximum', 1000);
$language = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data; $budgetMaximum = $budgetMax->data;
return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange')); $showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', 'false') == 'true';
return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'showIncomplete'));
} }
/** /**
@@ -70,7 +72,7 @@ class PreferencesController extends Controller
// language: // language:
$lang = Input::get('language'); $lang = Input::get('language');
if (in_array($lang, array_keys(Config::get('firefly.lang')))) { if (in_array($lang, array_keys(Config::get('firefly.languages')))) {
Preferences::set('language', $lang); Preferences::set('language', $lang);
} }

View File

@@ -64,9 +64,11 @@ class Authenticate
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US')); $pref = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'));
App::setLocale($pref->data); App::setLocale($pref->data);
Carbon::setLocale(substr($pref->data,0,2)); Carbon::setLocale(substr($pref->data,0,2));
$locale = explode(',', trans('config.locale'));
$locale = array_map('trim', $locale);
setlocale(LC_TIME, Config::get('firefly.locales.' . $pref->data)); setlocale(LC_TIME, $locale);
setlocale(LC_MONETARY, Config::get('firefly.locales.' . $pref->data)); setlocale(LC_MONETARY, $locale);
return $next($request); return $next($request);
} }

View File

@@ -354,8 +354,7 @@ Breadcrumbs::register(
'reports.report', function (Generator $breadcrumbs, Carbon $start, Carbon $end, $reportType, $accountIds) { 'reports.report', function (Generator $breadcrumbs, Carbon $start, Carbon $end, $reportType, $accountIds) {
$breadcrumbs->parent('reports.index'); $breadcrumbs->parent('reports.index');
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE','en_US'))->data; $monthFormat = trans('config.month_and_day');
$monthFormat = Config::get('firefly.monthAndDay.' . $pref);
$title = trans('firefly.report_default', ['start' => $start->formatLocalized($monthFormat), 'end' => $end->formatLocalized($monthFormat)]); $title = trans('firefly.report_default', ['start' => $start->formatLocalized($monthFormat), 'end' => $end->formatLocalized($monthFormat)]);
$breadcrumbs->push($title, route('reports.report', ['url' => 'abcde'])); $breadcrumbs->push($title, route('reports.report', ['url' => 'abcde']));

View File

@@ -2,6 +2,7 @@
return [ return [
// general stuff: // general stuff:
'language_incomplete' => 'This language is not yet fully translated',
'test' => 'You have selected English.', 'test' => 'You have selected English.',
'close' => 'Close', 'close' => 'Close',
'pleaseHold' => 'Please hold...', 'pleaseHold' => 'Please hold...',

View File

@@ -21,9 +21,11 @@
<div class="checkbox"> <div class="checkbox">
<label> <label>
{% if account.id in frontPageAccounts.data or frontPageAccounts.data|length == 0 %} {% if account.id in frontPageAccounts.data or frontPageAccounts.data|length == 0 %}
<input type="checkbox" name="frontPageAccounts[]" value="{{ account.id }}" checked> {{ account.name }} <input type="checkbox" name="frontPageAccounts[]" value="{{ account.id }}"
checked> {{ account.name }}
{% else %} {% else %}
<input type="checkbox" name="frontPageAccounts[]" value="{{ account.id }}"> {{ account.name }} <input type="checkbox" name="frontPageAccounts[]"
value="{{ account.id }}"> {{ account.name }}
{% endif %} {% endif %}
</label> </label>
</div> </div>
@@ -55,35 +57,40 @@
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="viewRange" value="1D" {% if viewRange == '1D' %} checked {% endif %}> <input type="radio" name="viewRange"
value="1D" {% if viewRange == '1D' %} checked {% endif %}>
{{ 'pref_1D'|_ }} {{ 'pref_1D'|_ }}
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="viewRange" value="1W" {% if viewRange == '1W' %} checked {% endif %}> <input type="radio" name="viewRange"
value="1W" {% if viewRange == '1W' %} checked {% endif %}>
{{ 'pref_1W'|_ }} {{ 'pref_1W'|_ }}
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="viewRange" value="1M" {% if viewRange == '1M' %} checked {% endif %}> <input type="radio" name="viewRange"
value="1M" {% if viewRange == '1M' %} checked {% endif %}>
{{ 'pref_1M'|_ }} {{ 'pref_1M'|_ }}
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="viewRange" value="3M" {% if viewRange == '3M' %} checked {% endif %}> <input type="radio" name="viewRange"
value="3M" {% if viewRange == '3M' %} checked {% endif %}>
{{ 'pref_3M'|_ }} {{ 'pref_3M'|_ }}
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="viewRange" value="6M" {% if viewRange == '6M' %} checked {% endif %}> <input type="radio" name="viewRange"
value="6M" {% if viewRange == '6M' %} checked {% endif %}>
{{ 'pref_6M'|_ }} {{ 'pref_6M'|_ }}
</label> </label>
</div> </div>
@@ -97,17 +104,22 @@
</div> </div>
<div class="box-body"> <div class="box-body">
<p class="text-info">{{ 'pref_languages_help'|_ }}</p> <p class="text-info">{{ 'pref_languages_help'|_ }}</p>
{% for key, lang in Config.get('firefly.lang') %} {% for key, lang in Config.get('firefly.languages') %}
<div class="radio"> {% if lang.complete == true or (lang.complete == false and showIncomplete) %}
<label> <div class="radio">
<input type="radio" name="language" value="{{ key }}" <label>
{% if language == key %} <input type="radio" name="language" value="{{ key }}"
checked {% if language == key %}
{% endif %} checked
/> {% endif %}
{{ lang }} />
</label> {{ lang.name_locale }} ({{ lang.name_english }})
</div> {% if lang.complete == false %}
<span class="small text-danger">({{ 'language_incomplete'|_ }})</span>
{% endif %}
</label>
</div>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>