src/Forms/NumericField.php
protected function getFormatter()
    {
        if ($this->getHTML5()) {
            // Locale-independent html5 number formatter
            $formatter = NumberFormatter::create(
                i18n::config()->uninherited('default_locale'),
                NumberFormatter::DECIMAL
            );
            $formatter->setAttribute(NumberFormatter::GROUPING_USED, false);
            $formatter->setSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '.');
        } else {
            // Locale-specific number formatter
            $formatter = NumberFormatter::create($this->getLocale(), NumberFormatter::DECIMAL);
        }

        // Set decimal precision
        $scale = $this->getScale();
        if ($scale === 0) {
            $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, false);
            $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 0);
        } else {
            $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, true);
            if ($scale === null) {
                // At least one digit to distinguish floating point from integer
                $formatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 1);
            } else {
                $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $scale);
            }
        }
        return $formatter;
    }
protected function getFormatter()
    {
        if ($this->getHTML5()) {
            // Locale-independent html5 number formatter
            $formatter = NumberFormatter::create(
                i18n::config()->uninherited('default_locale'),
                NumberFormatter::DECIMAL
            );
            $formatter->setAttribute(NumberFormatter::GROUPING_USED, false);
            $formatter->setSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '.');
        } else {
            // Locale-specific number formatter
            $formatter = NumberFormatter::create($this->getLocale(), NumberFormatter::DECIMAL);
        }

        // Set decimal precision
        $scale = $this->getScale();
        if ($scale === 0) {
            $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, false);
            $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 0);
        } else {
            $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, true);
            if ($scale === null) {
                // At least one digit to distinguish floating point from integer
                $formatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 1);
            } else {
                $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $scale);
            }
        }
        return $formatter;
    }
protected function getFormatter ( ) { if ( $ this -> getHTML5 ( ) ) { // Locale-independent html5 number formatter $ formatter = NumberFormatter :: create ( i18n :: config ( ) -> uninherited ( 'default_locale' ) , NumberFormatter :: DECIMAL ) ; $ formatter -> setAttribute ( NumberFormatter :: GROUPING_USED , false ) ; $ formatter -> setSymbol ( NumberFormatter :: DECIMAL_SEPARATOR_SYMBOL , '.' ) ; } else { // Locale-specific number formatter $ formatter = NumberFormatter :: create ( $ this -> getLocale ( ) , NumberFormatter :: DECIMAL ) ; } // Set decimal precision $ scale = $ this -> getScale ( ) ; if ( $ scale === 0 ) { $ formatter -> setAttribute ( NumberFormatter :: DECIMAL_ALWAYS_SHOWN , false ) ; $ formatter -> setAttribute ( NumberFormatter :: FRACTION_DIGITS , 0 ) ; } else { $ formatter -> setAttribute ( NumberFormatter :: DECIMAL_ALWAYS_SHOWN , true ) ; if ( $ scale === null ) { // At least one digit to distinguish floating point from integer $ formatter -> setAttribute ( NumberFormatter :: MIN_FRACTION_DIGITS , 1 ) ; } else { $ formatter -> setAttribute ( NumberFormatter :: FRACTION_DIGITS , $ scale ) ; } } return $ formatter ; }
Get number formatter for localising this field

@return NumberFormatter
Get number formatter for localising this field