diff options
author | Takayuki ORITO <iori.ayane@gmail.com> | 2014-12-12 22:52:19 +0900 |
---|---|---|
committer | Niels Weber <niels.weber@theqtcompany.com> | 2014-12-18 11:12:01 +0100 |
commit | ccdf663923cfc286912fc2f5cdc6714ddca9d6ba (patch) | |
tree | 618e344d50a1d5ccce5feea6c67c4170cab575ad | |
parent | 03575555a58a5112f48120985a0006b6e3596991 (diff) |
Updated the method of assembling a message for a better translation.
Also added check to decide whether to add a space.
Change-Id: Ibcd9b10ea093426eac53ddbd3cf8c8a190dcf294
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
-rw-r--r-- | src/libs/installer/observer.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libs/installer/observer.cpp b/src/libs/installer/observer.cpp index cfb3d3c31..4bc6d6721 100644 --- a/src/libs/installer/observer.cpp +++ b/src/libs/installer/observer.cpp @@ -68,14 +68,15 @@ QString FileTaskObserver::progressText() const if (bytesReceived.endsWith(tmp)) bytesReceived.chop(tmp.length()); - progressText = bytesReceived + tr(" of ") + bytesToReceive; + progressText = tr("%1 of %2").arg(bytesReceived).arg(bytesToReceive); } else { if (m_bytesTransfered > 0) - progressText = QInstaller::humanReadableSize(m_bytesTransfered) + tr(" received."); + progressText = tr("%1 received.").arg(QInstaller::humanReadableSize(m_bytesTransfered)); } - progressText += QLatin1String(" (") + QInstaller::humanReadableSize(m_bytesPerSecond) + tr("/sec") - + QLatin1Char(')'); + if (!progressText.isEmpty()) + progressText += QLatin1Char(' '); + progressText += tr("(%1/sec)").arg(QInstaller::humanReadableSize(m_bytesPerSecond)); if (m_bytesToTransfer > 0 && m_bytesPerSecond > 0) { const qint64 time = (m_bytesToTransfer - m_bytesTransfered) / m_bytesPerSecond; @@ -86,22 +87,22 @@ QString FileTaskObserver::progressText() const QString days; if (d > 0) - days = QString::number(d) + (d < 2 ? tr(" day") : tr(" days")) + QLatin1String(", "); + days = tr("%n day(s), ", "", d); QString hours; if (h > 0) - hours = QString::number(h) + (h < 2 ? tr(" hour") : tr(" hours")) + QLatin1String(", "); + hours = tr("%n hour(s), ", "", h); QString minutes; if (m > 0) - minutes = QString::number(m) + (m < 2 ? tr(" minute") : tr(" minutes")); + minutes = tr("%n minute(s)", "", m); QString seconds; if (s >= 0 && minutes.isEmpty()) { s = (s <= 0 ? 1 : s); - seconds = QString::number(s) + (s < 2 ? tr(" second") : tr(" seconds")); + seconds = tr("%n second(s)", "", s); } - progressText += tr(" - ") + days + hours + minutes + seconds + tr(" remaining."); + progressText += tr(" - %1%2%3%4 remaining.").arg(days).arg(hours).arg(minutes).arg(seconds); } else { progressText += tr(" - unknown time remaining."); } |