From ba957196dad6df78e7552288a17c7c9e8f64fd19 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 4 Jan 2017 13:14:06 +0100 Subject: [PATCH] Make sure correct locale is used. Debug info. #521 [skip ci] --- app/Support/Amount.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 1e52f19ef3..8294a53021 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -17,6 +17,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; use Illuminate\Support\Collection; +use Log; use Preferences as Prefs; /** @@ -50,7 +51,10 @@ class Amount */ public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string { - setlocale(LC_MONETARY, 0); + $locale = explode(',', trans('config.locale')); + $locale = array_map('trim', $locale); + Log::debug('formatAnything(). Will set locale to', $locale); + setlocale(LC_MONETARY, $locale); $float = round($amount, 12); $info = localeconv(); $formatted = number_format($float, $format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);