diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormat.php b/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormat.php index 79b47112e2a2bf2bebef91b4906d85bde2a479c2..874cad99f48e23cd432aba240b182d5298b5c3b5 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormat.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SafeMoneyFormat.php @@ -88,8 +88,15 @@ class SafeMoneyFormat extends AbstractHelper $currency = $this->defaultCurrency; } $escaper = $this->getView()->plugin('escapeHtml'); - return $escaper( + // Workaround for a problem in ICU library < 4.9 causing formatCurrency to + // fail if locale has comma as a decimal separator. + // (see https://bugs.php.net/bug.php?id=54538) + $locale = setlocale(LC_ALL, 0); + setlocale(LC_ALL, ['en_us.UTF-8', 'en_us.UTF8', 'en_us']); + $result = $escaper( $this->formatter->formatCurrency((float)$number, $currency) ); + setlocale(LC_ALL, $locale); + return $result; } }