Use Symfony formatter for currency symbol placement (#542)

This commit is contained in:
Sanjit Patel
2019-02-08 10:56:47 -05:00
committed by Kevin Papst
parent b2587c71b8
commit 616d514d5a
12 changed files with 58 additions and 33 deletions

View File

@@ -254,7 +254,7 @@ class Extensions extends \Twig_Extension
if ($this->locale !== $locale) {
$this->locale = $locale;
$this->numberFormatter = new NumberFormatter($locale, NumberFormatter::DECIMAL);
$this->numberFormatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
}
$fractionDigits = Intl::getCurrencyBundle()->getFractionDigits($currency);
@@ -262,7 +262,7 @@ class Extensions extends \Twig_Extension
$result = $this->numberFormatter->format($amount);
if (null !== $currency) {
$result .= ' ' . Intl::getCurrencyBundle()->getCurrencySymbol($currency, $locale);
$result = $this->numberFormatter->formatCurrency($amount, $currency);
}
return $result;