protected function parseUsingLocaleIfConfigured($source, PropertyMappingConfigurationInterface $configuration)
    {
        $configuration = $this->getConfigurationKeysAndValues($configuration, ['locale', 'strictMode', 'formatLength', 'formatType']);

        if ($configuration['locale'] === null) {
            return $source;
        } elseif ($configuration['locale'] === true) {
            $locale = $this->localizationService->getConfiguration()->getCurrentLocale();
        } elseif (is_string($configuration['locale'])) {
            $locale = new Locale($configuration['locale']);
        } elseif ($configuration['locale'] instanceof Locale) {
            $locale = $configuration['locale'];
        }

        if (!($locale instanceof Locale)) {
            $exceptionMessage = 'Determined locale is not of type "\Neos\Flow\I18n\Locale", but of type "' . (is_object($locale) ? get_class($locale) : gettype($locale)) . '".';
            throw new InvalidPropertyMappingConfigurationException($exceptionMessage, 1334837413);
        }

        if ($configuration['strictMode'] === null || $configuration['strictMode'] === true) {
            $strictMode = true;
        } else {
            $strictMode = false;
        }

        if ($configuration['formatLength'] !== null) {
            $formatLength = $configuration['formatLength'];
            NumbersReader::validateFormatLength($formatLength);
        } else {
            $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT;
        }

        if ($configuration['formatType'] !== null) {
            $formatType = $configuration['formatType'];
            NumbersReader::validateFormatType($formatType);
        } else {
            $formatType = NumbersReader::FORMAT_TYPE_DECIMAL;
        }

        if ($formatType === NumbersReader::FORMAT_TYPE_PERCENT) {
            $return = $this->numberParser->parsePercentNumber($source, $locale, $formatLength, $strictMode);
            if ($return === false) {
                $return = new Error('A valid percent number is expected.', 1334839253);
            }
        } else {
            $return = $this->numberParser->parseDecimalNumber($source, $locale, $formatLength, $strictMode);
            if ($return === false) {
                $return = new Error('A valid decimal number is expected.', 1334839260);
            }
        }

        return $return;
    }