From 47c5d56c7b77c944dbb7904719a5034860da44ad Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 7 Mar 2017 21:29:47 +0300 Subject: [PATCH] Use QLocale for amount + currency formatting. --- Telegram/SourceFiles/history/history_media_types.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 236409417..8481247df 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -3448,11 +3448,12 @@ QString HistoryInvoice::fillAmountAndCurrency(int amount, const QString ¤c { qsl("EUR"), QString::fromUtf8("\xE2\x82\xAC") }, { qsl("JPY"), QString::fromUtf8("\xC2\xA5") }, }; - auto amountBucks = amount / 100; - auto amountCents = amount % 100; - auto amountText = qsl("%1,%2").arg(amountBucks).arg(amountCents, 2, 10, QChar('0')); auto currencyText = shortCurrencyNames.value(currency, currency); - return currencyText + amountText; + return QLocale::system().toCurrencyString(amount / 100., currencyText); + //auto amountBucks = amount / 100; + //auto amountCents = amount % 100; + //auto amountText = qsl("%1,%2").arg(amountBucks).arg(amountCents, 2, 10, QChar('0')); + //return currencyText + amountText; } void HistoryInvoice::fillFromData(const MTPDmessageMediaInvoice &data) {