Skip to content

Commit 97082a4

Browse files
Fixed plural translation forms (#4183)
1 parent e7acf1c commit 97082a4

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

app/inpututils.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,36 +238,36 @@ QString InputUtils::formatDateTimeDiff( const QDateTime &tMin, const QDateTime &
238238
else if ( secsDiff < 60 * 60 )
239239
{
240240
int period = secsDiff / 60 ;
241-
return ( period > 1 ) ? tr( "%1 minutes ago" ).arg( period ) : tr( "%1 minute ago" ).arg( period );
241+
return tr( "%n minute(s) ago", "", period );
242242
}
243243
else if ( secsDiff < 60 * 60 * 24 )
244244
{
245245
int period = secsDiff / ( 60 * 60 );
246-
return ( period > 1 ) ? tr( "%1 hours ago" ).arg( period ) : tr( "%1 hour ago" ).arg( period );
246+
return tr( "%n hour(s) ago", "", period );
247247
}
248248
else
249249
{
250-
return ( daysDiff > 1 ) ? tr( "%1 days ago" ).arg( daysDiff ) : tr( "%1 day ago" ).arg( daysDiff );
250+
return tr( "%n day(s) ago", "", daysDiff );
251251
}
252252
}
253253
else if ( daysDiff < 7 )
254254
{
255-
return ( daysDiff > 1 ) ? tr( "%1 days ago" ).arg( daysDiff ) : tr( "%1 day ago" ).arg( daysDiff );
255+
return tr( "%n day(s) ago", "", daysDiff );
256256
}
257257
else if ( daysDiff < 31 )
258258
{
259259
int period = daysDiff / 7;
260-
return ( period > 1 ) ? tr( "%1 weeks ago" ).arg( period ) : tr( "%1 week ago" ).arg( period );
260+
return tr( "%n week(s) ago", "", period );
261261
}
262262
else if ( daysDiff < 365 )
263263
{
264264
int period = daysDiff / 31;
265-
return ( period > 1 ) ? tr( "%1 months ago" ).arg( period ) : tr( "%1 month ago" ).arg( period );
265+
return tr( "%n month(s) ago", "", period );
266266
}
267267
else
268268
{
269269
int period = daysDiff / 365;
270-
return ( period > 1 ) ? tr( "%1 years ago" ).arg( period ) : tr( "%1 year ago" ).arg( period );
270+
return tr( "%n year(s) ago", "", period );
271271
}
272272

273273
return INVALID_DATETIME_STR;
@@ -2108,11 +2108,11 @@ QString InputUtils::invalidGeometryWarning( QgsVectorLayer *layer )
21082108

21092109
if ( QgsWkbTypes::isMultiType( layer->wkbType() ) )
21102110
{
2111-
return tr( "You need to add at least %1 point(s) to every part." ).arg( nPoints );
2111+
return tr( "You need to add at least %n point(s) to every part.", "", nPoints );
21122112
}
21132113
else
21142114
{
2115-
return tr( "You need to add at least %1 point(s)." ).arg( nPoints );
2115+
return tr( "You need to add at least %n point(s).", "", nPoints );
21162116
}
21172117
}
21182118

app/qml/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ ApplicationWindow {
671671

672672
property int countToDelete: 0
673673

674-
title: qsTr( "Delete feature(s)", "", countToDelete )
674+
title: qsTr( "Delete %n feature(s)", "", countToDelete )
675675
description: qsTr( "Delete %n selected feature(s)?", "", countToDelete )
676676

677677
primaryButton.text: qsTr( "Yes, I want to delete" )

app/test/testutilsfunctions.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ void TestUtilsFunctions::testFormatDuration()
5252
testFormatDuration( t0, -1, QStringLiteral( "Invalid datetime" ) );
5353
testFormatDuration( t0, 0, QStringLiteral( "just now" ) );
5454
testFormatDuration( t0, 1, QStringLiteral( "just now" ) );
55-
testFormatDuration( t0, 60, QStringLiteral( "1 minute ago" ) );
56-
testFormatDuration( t0, 2 * 60, QStringLiteral( "2 minutes ago" ) );
57-
testFormatDuration( t0, 1 * 60 * 60, QStringLiteral( "1 hour ago" ) );
58-
testFormatDuration( t0, 2 * 60 * 60, QStringLiteral( "2 hours ago" ) );
59-
testFormatDuration( t0, 1 * DAY_IN_SECS, QStringLiteral( "1 day ago" ) );
60-
testFormatDuration( t0, 2 * DAY_IN_SECS, QStringLiteral( "2 days ago" ) );
61-
testFormatDuration( t0, 7 * DAY_IN_SECS, QStringLiteral( "1 week ago" ) );
62-
testFormatDuration( t0, 14 * DAY_IN_SECS, QStringLiteral( "2 weeks ago" ) );
63-
testFormatDuration( t0, MONTH_IN_SECS, QStringLiteral( "1 month ago" ) );
64-
testFormatDuration( t0, 2 * MONTH_IN_SECS, QStringLiteral( "2 months ago" ) );
65-
testFormatDuration( t0, 12 * MONTH_IN_SECS, QStringLiteral( "1 year ago" ) );
66-
testFormatDuration( t0, 24 * MONTH_IN_SECS, QStringLiteral( "2 years ago" ) );
55+
testFormatDuration( t0, 60, QStringLiteral( "1 minute(s) ago" ) );
56+
testFormatDuration( t0, 2 * 60, QStringLiteral( "2 minute(s) ago" ) );
57+
testFormatDuration( t0, 1 * 60 * 60, QStringLiteral( "1 hour(s) ago" ) );
58+
testFormatDuration( t0, 2 * 60 * 60, QStringLiteral( "2 hour(s) ago" ) );
59+
testFormatDuration( t0, 1 * DAY_IN_SECS, QStringLiteral( "1 day(s) ago" ) );
60+
testFormatDuration( t0, 2 * DAY_IN_SECS, QStringLiteral( "2 day(s) ago" ) );
61+
testFormatDuration( t0, 7 * DAY_IN_SECS, QStringLiteral( "1 week(s) ago" ) );
62+
testFormatDuration( t0, 14 * DAY_IN_SECS, QStringLiteral( "2 week(s) ago" ) );
63+
testFormatDuration( t0, MONTH_IN_SECS, QStringLiteral( "1 month(s) ago" ) );
64+
testFormatDuration( t0, 2 * MONTH_IN_SECS, QStringLiteral( "2 month(s) ago" ) );
65+
testFormatDuration( t0, 12 * MONTH_IN_SECS, QStringLiteral( "1 year(s) ago" ) );
66+
testFormatDuration( t0, 24 * MONTH_IN_SECS, QStringLiteral( "2 year(s) ago" ) );
6767
}
6868

6969
void TestUtilsFunctions::testFormatDuration( const QDateTime &t0, qint64 diffSecs, const QString &expectedResult )

0 commit comments

Comments
 (0)