From 61ccde6b7c2c16a9576909a2ba68c7215ee40909 Mon Sep 17 00:00:00 2001 From: Valdnet <47037905+Valdnet@users.noreply.github.com> Date: Tue, 14 Sep 2021 17:31:19 +0200 Subject: [PATCH 1/2] improve translations of strings with numbers inside tell tr that there is a number inside the translated string such that translators can provide the proper plural forms Changing text strings to correctly import them into Transifex. Issue #3776. Signed-off-by: Valdnet <47037905+Valdnet@users.noreply.github.com> --- src/gui/userstatusselectormodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/userstatusselectormodel.cpp b/src/gui/userstatusselectormodel.cpp index 778013eaea863..69f698ade1c34 100644 --- a/src/gui/userstatusselectormodel.cpp +++ b/src/gui/userstatusselectormodel.cpp @@ -413,21 +413,21 @@ QString UserStatusSelectorModel::timeDifferenceToString(int differenceSecs) cons if (minutesLeft == 1) { return tr("1 minute"); } else { - return tr("%1 minutes").arg(minutesLeft); + return tr("%1 minutes", "", minutesLeft).arg(minutesLeft); } } else if (differenceSecs < 60 * 60 * 24) { const auto hoursLeft = std::ceil(differenceSecs / 60.0 / 60.0); if (hoursLeft == 1) { return tr("1 hour"); } else { - return tr("%1 hours").arg(hoursLeft); + return tr("%1 hours", "", hoursLeft).arg(hoursLeft); } } else { const auto daysLeft = std::ceil(differenceSecs / 60.0 / 60.0 / 24.0); if (daysLeft == 1) { return tr("1 day"); } else { - return tr("%1 days").arg(daysLeft); + return tr("%1 days", "", daysLeft).arg(daysLeft); } } } From 0640eb6c31eebdbbec0ce03cf2e177ee2ed6fc14 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 3 Jun 2022 12:15:14 +0200 Subject: [PATCH 2/2] convert double numbers to int because we expect them to be real ints we give them to APIs expecting int we compare them to int values Signed-off-by: Matthieu Gallien --- src/gui/userstatusselectormodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/userstatusselectormodel.cpp b/src/gui/userstatusselectormodel.cpp index 69f698ade1c34..7bc9172bed4db 100644 --- a/src/gui/userstatusselectormodel.cpp +++ b/src/gui/userstatusselectormodel.cpp @@ -409,21 +409,21 @@ QString UserStatusSelectorModel::timeDifferenceToString(int differenceSecs) cons if (differenceSecs < 60) { return tr("Less than a minute"); } else if (differenceSecs < 60 * 60) { - const auto minutesLeft = std::ceil(differenceSecs / 60.0); + const auto minutesLeft = static_cast(std::ceil(differenceSecs / 60.0)); if (minutesLeft == 1) { return tr("1 minute"); } else { return tr("%1 minutes", "", minutesLeft).arg(minutesLeft); } } else if (differenceSecs < 60 * 60 * 24) { - const auto hoursLeft = std::ceil(differenceSecs / 60.0 / 60.0); + const auto hoursLeft = static_cast(std::ceil(differenceSecs / 60.0 / 60.0)); if (hoursLeft == 1) { return tr("1 hour"); } else { return tr("%1 hours", "", hoursLeft).arg(hoursLeft); } } else { - const auto daysLeft = std::ceil(differenceSecs / 60.0 / 60.0 / 24.0); + const auto daysLeft = static_cast(std::ceil(differenceSecs / 60.0 / 60.0 / 24.0)); if (daysLeft == 1) { return tr("1 day"); } else {