- Fixed missing formatter loading
This commit is contained in:
parent
043fb90f8d
commit
5aa70dfd17
|
@ -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() ) );
|
||||
|
|
Loading…
Reference in New Issue