@VirtualProperty
@SerializedName("unitPriceFormatted")
@Groups({"Default","cart"})

@param string $locale

@throws PriceFormatterException

@return string
186682
public function getUnitPriceFormatted($locale = null)
    {
        return $this->priceFormatter->format((float)$this->getUnitPrice(), null, $locale);
    }
1207297
public function getTitle($locale = null)
    {
        if ($locale && isset($this->title[$locale])) {
            return $this->title[$locale];
        }

        if (isset($this->title['default'])) {
            return $this->title['default'];
        }

        return $this->getOriginalName();
    }
239005
public function generateRewrittenUrl($locale)
    {
        if ($this->isNew()) {
            throw new \RuntimeException(sprintf('Object %s must be saved before generating url', $this->getRewrittenUrlViewName()));
        }
        // Borrowed from http://stackoverflow.com/questions/2668854/sanitizing-strings-to-make-them-url-and-filename-safe

        $this->setLocale($locale);

        $generateEvent = new GenerateRewrittenUrlEvent($this, $locale);

        $this->dispatchEvent(TheliaEvents::GENERATE_REWRITTENURL, $generateEvent);

        if ($generateEvent->isRewritten()) {
            return $generateEvent->getUrl();
        }

        $title = $this->getTitle();

        if (null == $title) {
            throw new \RuntimeException('Impossible to create an url if title is null');
        }
        // Replace all weird characters with dashes
        $string = preg_replace('/[^\w\-~_\.]+/u', '-', $title);

        // Only allow one dash separator at a time (and make string lowercase)
        $cleanString = mb_strtolower(preg_replace('/--+/u', '-', $string), 'UTF-8');

        $urlFilePart = rtrim($cleanString, '.-~_') . ".html";

        try {
            $i=0;
            while (URL::getInstance()->resolve($urlFilePart)) {
                $i++;
                $urlFilePart = sprintf("%s-%d.html", $cleanString, $i);
            }
        } catch (UrlRewritingException $e) {
            $rewritingUrl = new RewritingUrl();
            $rewritingUrl->setUrl($urlFilePart)
                ->setView($this->getRewrittenUrlViewName())
                ->setViewId($this->getId())
                ->setViewLocale($locale)
                ->save()
            ;
        }

        return $urlFilePart;
    }
836061
public static function formatLocale($locale)
    {
        if (\is_string($locale)) {
            $locale = strtolower($locale);
            $locale = str_replace('-', '_', $locale);
        }

        return $locale;
    }
650461
public function locale($locale = null)
    {
        if ($locale) {
            $this->_locale = $locale;
        }
        if ($this->_locale) {
            return $this->_locale;
        }
        if (isset($this->_params['locale'])) {
            return $this->_params['locale'];
        }
    }
1233211
public function getTotalNetPriceFormatted($locale = null)
    {
        $formatter = $this->getFormatter($locale);

        return $formatter->format((float)$this->entity->getTotalNetPrice());
    }
1071317
protected function getFormatter($locale) {
		if (! isset($this->formatters[$locale])) {
			$this->formatters[$locale] = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
		}
		
		return $this->formatters[$locale];
	}
432084
public function getFormattedPrice($price, $symbol = 'EUR', $locale = 'de')
    {
        return $this->priceFormatter->format(
            (float) $price,
            null,
            $locale,
            $symbol,
            PriceFormatter::CURRENCY_LOCATION_SUFFIX
        );
    }
677558
protected function normalizeLocale($locale) {
		if ($locale instanceof Locale) {
			$locale = $locale->getPrimaryLanguage();
		}
		
		$underlinePos = strpos($locale, '_');
		
		if ($underlinePos !== false) {
			return substr($locale, 0, $underlinePos);
		}
		
		return $locale;
	}
118918
public function translate($locale = null)
    {
        if (!$locale) {
            $locale = \localizer\locale()->id();
        } else {
            $locale = (int)$locale;
        }

        return $this->getTranslation($locale);
    }
170301
public function getTotalRecurringTaxesFormatted($locale = null)
    {
        return $this->priceFormatter->format((float)$this->getTotalRecurringTaxes(), null, $locale);
    }
765605
public function formatLocale($locale = null, Closure $callback = null)
    {
        if (!class_exists('\NumberFormatter')) {
            throw new BadFunctionCallException('Class NumberFormatter not exists. Require ext-intl extension.');
        }

        $formatter = new \NumberFormatter($locale ?: static::getLocale(), \NumberFormatter::CURRENCY);

        if (is_callable($callback)) {
            $callback($formatter);
        }

        return $formatter->formatCurrency($this->getValue(), $this->currency->getCurrency());
    }
673468
public function getTotalPriceFormatted($locale = null)
    {
        return $this->priceFormatter->format((float)$this->entity->getTotalPrice(), null, $locale);
    }
265308
protected function getDefaultNumberFormatter($currencyCode, $locale = null)
    {
        if (is_null($locale)) {
            $locale = \Locale::getDefault();
        }
        $numberFormatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
        $numberFormatter->setTextAttribute(\NumberFormatter::CURRENCY_CODE, $currencyCode);
        $numberFormatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->decimals);

        return $numberFormatter;
    }
56561
public function formatByIntlLocalizedDecimal(
        $locale = null,
        Currencies $currencies = null,
        $style = NumberFormatter::CURRENCY
    ) {
        $numberFormatter = new NumberFormatter($locale ?: static::getLocale(), $style);
        $formatter = new IntlLocalizedDecimalFormatter($numberFormatter, $currencies ?: static::getCurrencies());

        return $this->formatByFormatter($formatter);
    }
45039
public function format($locale = null, Currencies $currencies = null, $style = NumberFormatter::CURRENCY)
    {
        return $this->formatByIntl($locale, $currencies, $style);
    }
250118
protected function getFormatter($locale) {
		if (! isset($this->formatters[$locale])) {
			$this->formatters[$locale] = new NumberFormatter($locale, NumberFormatter::CURRENCY);
		}
		
		return $this->formatters[$locale];
	}