diff --git a/src/Extension/NumberExtension.php b/src/Extension/NumberExtension.php index d328412..db03094 100644 --- a/src/Extension/NumberExtension.php +++ b/src/Extension/NumberExtension.php @@ -15,6 +15,7 @@ class NumberExtension implements Extension, FunctionExtension { public string $title = "", ) { $this->locale = explode('.', \Locale::getDefault())[0]; + $this->formatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY); } public function exportFunctions(): array @@ -55,8 +56,6 @@ class NumberExtension implements Extension, FunctionExtension { public function money(float $money, ? string $currency = null) /* : string|false */ { - $this->formatter ??= new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY); - $this->formatter->setTextAttribute(\NumberFormatter::CURRENCY_CODE, 'CAD'); $this->formatter->setPattern( str_replace('¤#','¤ #', $this->formatter->getPattern() ) );