[PATCH 2/2] Fix plurals translation
Dirk Hohndel
dirk at hohndel.org
Thu Oct 29 08:34:37 PDT 2015
So we had a bunch of problems with the plural forms and just dropped them
for 4.5
Are these resolved?
/D
On Thu, Oct 29, 2015 at 11:24:47AM +0300, sergey.starosek at gmail.com wrote:
> From: Sergey Starosek <sergey.starosek at gmail.com>
>
> This allows separate translation of singular and plural forms
>
> Signed-off-by: Sergey Starosek <sergey.starosek at gmail.com>
> ---
> qt-ui/modeldelegates.cpp | 2 +-
> qthelper.cpp | 11 ++++-------
> 2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
> index 7bdb699..881037a 100644
> --- a/qt-ui/modeldelegates.cpp
> +++ b/qt-ui/modeldelegates.cpp
> @@ -543,7 +543,7 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
> QString distance = distance_string(distanceMeters);
> int nr = nr_of_dives_at_dive_site(ds->uuid, false);
> bottomText += tr(" (~%1 away").arg(distance);
> - bottomText += tr(", %1 dive(s) here)").arg(nr);
> + bottomText += tr(", %n dive(s) here)", "", nr);
> }
> }
> if (bottomText.isEmpty()) {
> diff --git a/qthelper.cpp b/qthelper.cpp
> index 2f1f041..a12d253 100644
> --- a/qthelper.cpp
> +++ b/qthelper.cpp
> @@ -1074,14 +1074,11 @@ QString get_trip_date_string(timestamp_t when, int nr, bool getday)
> localTime.setTimeSpec(Qt::UTC);
> QString ret ;
>
> - if (nr != 1) {
> - if (getday) {
> - ret = localTime.date().toString(dateFormat) + " " + QObject::tr("(%1 dives)").arg(nr);
> - } else {
> - ret = localTime.date().toString("MMM yy") + " " + QObject::tr("(%1 dives)").arg(nr);
> - }
> + QString suffix = " " + QObject::tr("(%n dive(s))", "", nr);
> + if (getday) {
> + ret = localTime.date().toString(dateFormat) + suffix;
> } else {
> - ret = localTime.date().toString(dateFormat) + " " + QObject::tr("(1 dive)");
> + ret = localTime.date().toString("MMM yy") + suffix;
> }
> return ret;
>
> --
> 1.9.1
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface
mailing list