• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/Currency/CurrencyFormat.php
  • Класс: BitrixUICurrencyCurrencyFormat
  • Вызов: CurrencyFormat::convertByDefault
static function convertByDefault(float $price, string $currency, string $languageId = ''): string
{
	if (empty($languageId))
	{
		$languageId = LANGUAGE_ID;
	}

	if ($languageId === 'en' && $currency === "USD")
	{
		return "$".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'en' && $currency === "EUR")
	{
		return number_format($price, 2, ".", ",")." €";
	}
	if ($languageId === 'de' && $currency === "EUR")
	{
		return number_format($price, 2, ",", ".")." €";
	}
	if ($languageId === 'la' && $currency === "USD")
	{
		return "$".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'br' && $currency === "BRL")
	{
		return "R$".number_format($price, 2, ",", ".");
	}
	if ($languageId === 'fr' && $currency === "EUR")
	{
		return number_format($price, 2, ".", ",")." €";
	}
	if ($languageId === 'it' && $currency === "EUR")
	{
		return number_format($price, 2, ",", ".")." €";
	}
	if ($languageId === 'pl' && $currency === "PLN")
	{
		return number_format($price, 2, ",", " ")." ¤";
	}
	if ($languageId === 'tr' && $currency === "TRY")
	{
		return number_format($price, 2, ",", ".")."₺";
	}
	if ($languageId === 'sc' && $currency === "CNY")
	{
		return "¥".number_format($price, 2, ".", "");
	}
	if ($languageId === 'tc' && $currency === "TWD")
	{
		return "NT$;".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'ja' && $currency === "JPY")
	{
		return number_format($price, 2, "", ",")."¥";
	}
	if ($languageId === 'vn' && $currency === "VND")
	{
		return number_format($price, 2, ",", ".")." ₫";
	}
	if ($languageId === 'id' && $currency === "IDR")
	{
		return "Rs. ".number_format($price, 2, ",", ".");
	}
	if ($languageId === 'ms' && $currency === "MYR")
	{
		return "RM ".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'th' && $currency === "THB")
	{
		return "฿ ".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'en' && $currency === "IDR")
	{
		return "Rs. ".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'hi' && $currency === "IDR")
	{
		return "Rs. ".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'en' && $currency === "GBP")
	{
		return "£".number_format($price, 2, ".", ",");
	}
	if ($languageId === 'la' && $currency === "MXN")
	{
		return "$".number_format($price, 2, ",", ".");
	}
	if ($languageId === 'la' && $currency === "COP")
	{
		return "$".number_format($price, 2, ",", ".");
	}

	return "$".number_format($price, 2, ",", ".");
}