NumberFormatter.php in Price 3.x
File
src/NumberFormatter.php
View source
<?php
namespace Drupal\price;
use CommerceGuys\Intl\Formatter\NumberFormatter as ExternalNumberFormatter;
use CommerceGuys\Intl\NumberFormat\NumberFormatRepositoryInterface;
use Drupal\price\CurrentLocaleInterface;
class NumberFormatter extends ExternalNumberFormatter {
public function __construct(NumberFormatRepositoryInterface $number_format_repository, CurrentLocaleInterface $current_locale) {
$default_options = [
'locale' => $current_locale
->getLocale()
->getLocaleCode(),
];
parent::__construct($number_format_repository, $default_options);
}
}
Classes
Name |
Description |
NumberFormatter |
Extends the commerceguys/intl NumberFormatter to provide better defaults. |