public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        $locale = SwatI18NLocale::get($this->locale);
        $format = $locale->getNationalCurrencyFormat();
        $max_decimal_places =
            $this->decimal_places === null
                ? $format->fractional_digits
                : $this->decimal_places;

        $value = $this->getRawValue();

        // Get the number of entered fractional digits places from the raw
        // value. This checks the raw value instead of the processed value
        // because the processed value could have been parsed into a float by
        // this point.
        $decimal_position = mb_strpos(
            (string) $value,
            $format->decimal_separator
        );
        if ($decimal_position === false) {
            $decimal_places = 0;
        } else {
            $fractional_digits = mb_substr(
                rtrim((string) $value, '0'),
                $decimal_position + mb_strlen($format->decimal_separator)
            );

            $decimal_places = preg_match_all('/[0-9]/', $fractional_digits);
        }

        // check if length of the given fractional part is more than the
        // allowed length
        if ($decimal_places > $max_decimal_places) {
            // validation failed so reset value to the raw value
            $this->value = $value;

            if ($this->decimal_places === null) {
                $message = $this->getValidationMessage(
                    'currency-decimal-places'
                );

                $max_decimal_places_formatted = str_replace(
                    '%',
                    '%%',
                    $locale->formatNumber($max_decimal_places)
                );

                // C99 specification includes spacing character, remove it
                $currency_formatted = str_replace(
                    '%',
                    '%%',
                    $locale->getInternationalCurrencySymbol()
                );

                $message->primary_content = sprintf(
                    $message->primary_content,
                    $currency_formatted,
                    $max_decimal_places_formatted
                );
            } else {
                if ($max_decimal_places === 0) {
                    $message = $this->getValidationMessage('no-decimal-places');
                } else {
                    $max_decimal_places_formatted = str_replace(
                        '%',
                        '%%',
                        $locale->formatNumber($max_decimal_places)
                    );

                    // note: not using getValidationMessage() because of
                    // ngettext. We may want to add this ability to that method
                    $message = new SwatMessage(
                        sprintf(
                            Swat::ngettext(
                                'The %%s field has too many decimal places. There ' .
                                    'can be at most one decimal place.',
                                'The %%s field has too many decimal places. There ' .
                                    'can be at most %s decimal places.',
                                $max_decimal_places
                            ),
                            $max_decimal_places_formatted
                        ),
                        'error'
                    );
                }
            }

            $this->addMessage($message);
        }
    }