From: eileen Date: Fri, 26 Feb 2021 05:05:14 +0000 (+1300) Subject: dev/financial#166 Fix for inconsistency around currency symbol X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=78bafaf06ac349f75896af2ae3ca8ac812bbbb48;p=civicrm-core.git dev/financial#166 Fix for inconsistency around currency symbol From https://lab.civicrm.org/dev/financial/-/issues/166 we learn that the existing code (tested via testFormatLocaleNumericRoundedByCurrency) is not consistent across all platforms. I think this may be --- diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index 02b0ed54cc..9fbb1ce5ad 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -215,8 +215,7 @@ class CRM_Utils_Money { // fix to allow us to resolve formatLocaleNumericRoundedByPrecision // and to make the function comments correct - but, we need to reconsider this // in master as it is probably better to use locale than our currency separator fields. - $formatter = new \NumberFormatter('en_US', NumberFormatter::CURRENCY); - $formatter->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, ''); + $formatter = new \NumberFormatter('en_US', NumberFormatter::DECIMAL); $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $numberOfPlaces); return $money->formatWith($formatter); }