Merge pull request #3578 from hoshsadiq/feature/use-intl-formatter

Use php-intl to format currencies
This commit is contained in:
James Cole
2020-07-19 18:05:25 +00:00
committed by GitHub
6 changed files with 119 additions and 143 deletions

View File

@@ -144,9 +144,8 @@ class JavascriptController extends Controller
$currency = app('amount')->getDefaultCurrency();
}
$localeconv = app('amount')->getLocaleInfo();
$accounting = app('amount')->getJsConfig($localeconv);
$localeconv['frac_digits'] = $currency->decimal_places;
$accountingLocaleInfo = app('amount')->getAccountingLocaleInfo();
$accountingLocaleInfo['frac_digits'] = $currency->decimal_places;
$pref = app('preferences')->get('language', config('firefly.default_language', 'en_US'));
/** @noinspection NullPointerExceptionInspection */
$lang = $pref->data;
@@ -154,14 +153,13 @@ class JavascriptController extends Controller
$uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);
$data = [
'currencyCode' => $currency->code,
'currencySymbol' => $currency->symbol,
'accounting' => $accounting,
'localeconv' => $localeconv,
'language' => $lang,
'dateRangeTitle' => $dateRange['title'],
'dateRangeConfig' => $dateRange['configuration'],
'uid' => $uid,
'currencyCode' => $currency->code,
'currencySymbol' => $currency->symbol,
'accountingLocaleInfo' => $accountingLocaleInfo,
'language' => $lang,
'dateRangeTitle' => $dateRange['title'],
'dateRangeConfig' => $dateRange['configuration'],
'uid' => $uid,
];
$request->session()->keep(['two-factor-secret']);