mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various date localisation. [skip ci]
This commit is contained in:
parent
de9ac97887
commit
417766f0db
@ -68,13 +68,14 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function listOfMonths(Carbon $date)
|
public function listOfMonths(Carbon $date)
|
||||||
{
|
{
|
||||||
|
|
||||||
$start = clone $date;
|
$start = clone $date;
|
||||||
$end = Carbon::now();
|
$end = Carbon::now();
|
||||||
$months = [];
|
$months = [];
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$year = $start->year;
|
$year = $start->year;
|
||||||
$months[$year][] = [
|
$months[$year][] = [
|
||||||
'formatted' => $start->format('F Y'),
|
'formatted' => $start->formatLocalized('%B %Y'),
|
||||||
'month' => $start->month,
|
'month' => $start->month,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
];
|
];
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
|
use Config;
|
||||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
use Preferences;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,6 +18,11 @@ abstract class Controller extends BaseController
|
|||||||
|
|
||||||
use DispatchesCommands, ValidatesRequests;
|
use DispatchesCommands, ValidatesRequests;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $monthAndDayFormat;
|
||||||
|
/** @var string */
|
||||||
|
protected $monthFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -24,5 +32,16 @@ abstract class Controller extends BaseController
|
|||||||
View::share('hideCategories', false);
|
View::share('hideCategories', false);
|
||||||
View::share('hideBills', false);
|
View::share('hideBills', false);
|
||||||
View::share('hideTags', false);
|
View::share('hideTags', false);
|
||||||
|
|
||||||
|
if (Auth::check()) {
|
||||||
|
$pref = Preferences::get('language', 'en');
|
||||||
|
$lang = $pref->data;
|
||||||
|
$this->monthFormat = Config::get('firefly.month.' . $lang);
|
||||||
|
$this->monthAndDayFormat = Config::get('firefly.monthAndDay.' . $lang);
|
||||||
|
|
||||||
|
View::share('monthFormat', $this->monthFormat);
|
||||||
|
View::share('monthAndDayFormat', $this->monthAndDayFormat);
|
||||||
|
View::share('language', $lang);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ class GoogleChartController extends Controller
|
|||||||
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
|
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
|
||||||
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
|
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
|
||||||
$allEntries->push(
|
$allEntries->push(
|
||||||
[$budget->name . ' (' . $repetition->startdate->format('j M Y') . ')',
|
[$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',
|
||||||
$left,
|
$left,
|
||||||
$spent,
|
$spent,
|
||||||
$overspent
|
$overspent
|
||||||
|
@ -6,7 +6,7 @@ use FireflyIII\Models\Preference;
|
|||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
|
use Config;
|
||||||
/**
|
/**
|
||||||
* Class Authenticate
|
* Class Authenticate
|
||||||
*
|
*
|
||||||
@ -55,6 +55,7 @@ class Authenticate
|
|||||||
$pref = Preferences::get('language', 'en');
|
$pref = Preferences::get('language', 'en');
|
||||||
App::setLocale($pref->data);
|
App::setLocale($pref->data);
|
||||||
|
|
||||||
|
setlocale(LC_TIME, Config::get('firefly.locales.'.$pref->data));
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -94,5 +94,17 @@ return [
|
|||||||
'en' => 'English',
|
'en' => 'English',
|
||||||
'nl' => 'Nederlands'
|
'nl' => 'Nederlands'
|
||||||
],
|
],
|
||||||
|
'locales' => [
|
||||||
|
'en' => ['en', 'English', 'en_US', 'en_US.utf8'],
|
||||||
|
'nl' => ['nl', 'Dutch', 'nl_NL', 'nl_NL.utf8'],
|
||||||
|
],
|
||||||
|
'month' => [
|
||||||
|
'en' => '%B %Y',
|
||||||
|
'nl' => '%B %Y',
|
||||||
|
],
|
||||||
|
'monthAndDay' => [
|
||||||
|
'en' => '%B %e, %Y',
|
||||||
|
'nl' => '%e %B %Y',
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var google = google || {};
|
var google = google || {};
|
||||||
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line', 'sankey', 'table']});
|
google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line'],'language': language });
|
||||||
|
|
||||||
function googleChart(chartType, URL, container, options) {
|
function googleChart(chartType, URL, container, options) {
|
||||||
if ($('#' + container).length === 1) {
|
if ($('#' + container).length === 1) {
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
var firstDate = moment("{{Session.get('first').format('Y-m-d')}}");
|
var firstDate = moment("{{Session.get('first').format('Y-m-d')}}");
|
||||||
var currentMonthName = "{{ currentMonthName }}";
|
var currentMonthName = "{{ currentMonthName }}";
|
||||||
var previousMonthName = "{{ previousMonthName }}";
|
var previousMonthName = "{{ previousMonthName }}";
|
||||||
|
var language = "{{ language }}";
|
||||||
var nextMonthName = "{{ nextMonthName }}";
|
var nextMonthName = "{{ nextMonthName }}";
|
||||||
var currencyCode = '{{getCurrencyCode() }}';
|
var currencyCode = '{{getCurrencyCode() }}';
|
||||||
$('#daterange span').text(titleString);
|
$('#daterange span').text(titleString);
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{journal.date.format('j F Y')}}
|
{{journal.date.formatLocalized(monthAndDayFormat)}}
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.transactions[0].account.accountType.type == 'Cash account' %}
|
{% if journal.transactions[0].account.accountType.type == 'Cash account' %}
|
||||||
|
Loading…
Reference in New Issue
Block a user