Better localisation in charts.

This commit is contained in:
James Cole 2015-12-20 08:40:58 +01:00
parent 32771fe7e1
commit 5e76488ae7
3 changed files with 11 additions and 6 deletions

View File

@ -34,7 +34,7 @@ abstract class Controller extends BaseController
View::share('hideTags', false);
if (Auth::check()) {
$pref = Preferences::get('language',env('DEFAULT_LANGUAGE','en_US'));
$pref = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'));
$lang = $pref->data;
$this->monthFormat = Config::get('firefly.month.' . $lang);
$this->monthAndDayFormat = Config::get('firefly.monthAndDay.' . $lang);
@ -42,6 +42,7 @@ abstract class Controller extends BaseController
View::share('monthFormat', $this->monthFormat);
View::share('monthAndDayFormat', $this->monthAndDayFormat);
View::share('language', $lang);
View::share('localeconv', localeconv());
}
}
}

View File

@ -1,4 +1,4 @@
/* globals $, Chart, currencySymbol */
/* globals $, Chart, currencySymbol,mon_decimal_point ,accounting, mon_thousands_sep, frac_digits */
/*
Make some colours:
@ -29,16 +29,16 @@ accounting.settings = {
currency: {
symbol : currencySymbol, // default currency symbol is '$'
format: "%s %v", // controls output: %s = symbol, %v = value/number (can be object: see below)
decimal : ",", // decimal point separator
thousand: ".", // thousands separator
precision : 2 // decimal places
decimal : mon_decimal_point, // decimal point separator
thousand: mon_thousands_sep, // thousands separator
precision : frac_digits // decimal places
},
number: {
precision : 0, // default precision on numbers is 0
thousand: ",",
decimal : "."
}
}
};
var fillColors = [];

View File

@ -184,6 +184,10 @@
var language = "{{ language }}";
var currencyCode = '{{ getCurrencyCode() }}';
var currencySymbol = '{{ getCurrencySymbol()|raw }}';
var mon_decimal_point = "{{ localeconv.mon_decimal_point }}";
var mon_thousands_sep = "{{ localeconv.mon_thousands_sep }}";
var frac_digits = {{ localeconv.frac_digits }};
</script>