mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Make sure correct locale is used. Debug info. #521 [skip ci]
This commit is contained in:
@@ -17,6 +17,7 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
use Preferences as Prefs;
|
use Preferences as Prefs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +51,10 @@ class Amount
|
|||||||
*/
|
*/
|
||||||
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string
|
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);
|
$float = round($amount, 12);
|
||||||
$info = localeconv();
|
$info = localeconv();
|
||||||
$formatted = number_format($float, $format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);
|
$formatted = number_format($float, $format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);
|
||||||
|
Reference in New Issue
Block a user