diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index 33014d0a4..126740fab 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -216,18 +217,19 @@ QString DownloadItem::currentSpeedToString(double speed) return tr("Unknown speed"); } + QLocale locale; speed /= 1024; // kB if (speed < 1000) { - return QString::number(speed, 'f', 0) + QLatin1String(" ") + tr("kB/s"); + return tr("%1 kB/s").arg(locale.toString(speed, 'f', 0)); } speed /= 1024; //MB if (speed < 1000) { - return QString::number(speed, 'f', 2) + QLatin1String(" ") + tr("MB/s"); + return tr("%1 MB/s").arg(locale.toString(speed, 'f', 2)); } speed /= 1024; //GB - return QString::number(speed, 'f', 2) + QLatin1String(" ") + tr("GB/s"); + return tr("%1 GB/s").arg(locale.toString(speed, 'f', 2)); } void DownloadItem::updateDownloadInfo(double currSpeed, qint64 received, qint64 total) diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index e7dda719d..6d85dd49c 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -378,18 +379,20 @@ QString QzTools::fileSizeToString(qint64 size) return QObject::tr("Unknown size"); } + QLocale locale; + double _size = size / 1024.0; // KB if (_size < 1000) { - return QString::number(_size > 1 ? _size : 1, 'f', 0) + QLatin1Char(' ') + QObject::tr("KB"); + return QObject::tr("%1 kB").arg(locale.toString(_size > 1 ? _size : 1, 'f', 0)); } _size /= 1024; // MB if (_size < 1000) { - return QString::number(_size, 'f', 1) + QLatin1Char(' ') + QObject::tr("MB"); + return QObject::tr("%1 MB").arg(locale.toString(_size, 'f', 1)); } _size /= 1024; // GB - return QString::number(_size, 'f', 2) + QLatin1Char(' ') + QObject::tr("GB"); + return QObject::tr("%1 GB").arg(locale.toString(_size, 'f', 2)); } QPixmap QzTools::createPixmapForSite(const QIcon &icon, const QString &title, const QString &url)