Skip to content

Commit

Permalink
Improved settings of NumberFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapjansma committed May 3, 2021
1 parent 74e38e1 commit 3092016
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CRM/Utils/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ public static function formatUnitSize($size, $checkForPostMax = FALSE) {
*/
public static function formatLocaleNumeric(string $amount, $locale = NULL): string {
$formatter = new \NumberFormatter($locale ?? CRM_Core_I18n::getLocale(), NumberFormatter::DECIMAL);
return self::replaceDecimalSeparators($formatter->format($amount));
$formatter->setSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, CRM_Core_Config::singleton()->monetaryDecimalPoint);
$formatter->setSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, CRM_Core_Config::singleton()->monetaryThousandSeparator);
return $formatter->format($amount);
}

/**
Expand Down

0 comments on commit 3092016

Please sign in to comment.