Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/inpututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,36 +238,36 @@ QString InputUtils::formatDateTimeDiff( const QDateTime &tMin, const QDateTime &
else if ( secsDiff < 60 * 60 )
{
int period = secsDiff / 60 ;
return ( period > 1 ) ? tr( "%1 minutes ago" ).arg( period ) : tr( "%1 minute ago" ).arg( period );
return tr( "%n minute(s) ago", "", period );
}
else if ( secsDiff < 60 * 60 * 24 )
{
int period = secsDiff / ( 60 * 60 );
return ( period > 1 ) ? tr( "%1 hours ago" ).arg( period ) : tr( "%1 hour ago" ).arg( period );
return tr( "%n hour(s) ago", "", period );
}
else
{
return ( daysDiff > 1 ) ? tr( "%1 days ago" ).arg( daysDiff ) : tr( "%1 day ago" ).arg( daysDiff );
return tr( "%n day(s) ago", "", daysDiff );
}
}
else if ( daysDiff < 7 )
{
return ( daysDiff > 1 ) ? tr( "%1 days ago" ).arg( daysDiff ) : tr( "%1 day ago" ).arg( daysDiff );
return tr( "%n day(s) ago", "", daysDiff );
}
else if ( daysDiff < 31 )
{
int period = daysDiff / 7;
return ( period > 1 ) ? tr( "%1 weeks ago" ).arg( period ) : tr( "%1 week ago" ).arg( period );
return tr( "%n week(s) ago", "", period );
}
else if ( daysDiff < 365 )
{
int period = daysDiff / 31;
return ( period > 1 ) ? tr( "%1 months ago" ).arg( period ) : tr( "%1 month ago" ).arg( period );
return tr( "%n month(s) ago", "", period );
}
else
{
int period = daysDiff / 365;
return ( period > 1 ) ? tr( "%1 years ago" ).arg( period ) : tr( "%1 year ago" ).arg( period );
return tr( "%n year(s) ago", "", period );
}

return INVALID_DATETIME_STR;
Expand Down Expand Up @@ -2099,11 +2099,11 @@ QString InputUtils::invalidGeometryWarning( QgsVectorLayer *layer )

if ( QgsWkbTypes::isMultiType( layer->wkbType() ) )
{
return tr( "You need to add at least %1 point(s) to every part." ).arg( nPoints );
return tr( "You need to add at least %n point(s) to every part.", "", nPoints );
}
else
{
return tr( "You need to add at least %1 point(s)." ).arg( nPoints );
return tr( "You need to add at least %n point(s).", "", nPoints );
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ ApplicationWindow {

property int countToDelete: 0

title: qsTr( "Delete feature(s)", "", countToDelete )
title: qsTr( "Delete %n feature(s)", "", countToDelete )
description: qsTr( "Delete %n selected feature(s)?", "", countToDelete )

primaryButton.text: qsTr( "Yes, I want to delete" )
Expand Down
24 changes: 12 additions & 12 deletions app/test/testutilsfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ void TestUtilsFunctions::testFormatDuration()
testFormatDuration( t0, -1, QStringLiteral( "Invalid datetime" ) );
testFormatDuration( t0, 0, QStringLiteral( "just now" ) );
testFormatDuration( t0, 1, QStringLiteral( "just now" ) );
testFormatDuration( t0, 60, QStringLiteral( "1 minute ago" ) );
testFormatDuration( t0, 2 * 60, QStringLiteral( "2 minutes ago" ) );
testFormatDuration( t0, 1 * 60 * 60, QStringLiteral( "1 hour ago" ) );
testFormatDuration( t0, 2 * 60 * 60, QStringLiteral( "2 hours ago" ) );
testFormatDuration( t0, 1 * DAY_IN_SECS, QStringLiteral( "1 day ago" ) );
testFormatDuration( t0, 2 * DAY_IN_SECS, QStringLiteral( "2 days ago" ) );
testFormatDuration( t0, 7 * DAY_IN_SECS, QStringLiteral( "1 week ago" ) );
testFormatDuration( t0, 14 * DAY_IN_SECS, QStringLiteral( "2 weeks ago" ) );
testFormatDuration( t0, MONTH_IN_SECS, QStringLiteral( "1 month ago" ) );
testFormatDuration( t0, 2 * MONTH_IN_SECS, QStringLiteral( "2 months ago" ) );
testFormatDuration( t0, 12 * MONTH_IN_SECS, QStringLiteral( "1 year ago" ) );
testFormatDuration( t0, 24 * MONTH_IN_SECS, QStringLiteral( "2 years ago" ) );
testFormatDuration( t0, 60, QStringLiteral( "1 minute(s) ago" ) );
testFormatDuration( t0, 2 * 60, QStringLiteral( "2 minute(s) ago" ) );
testFormatDuration( t0, 1 * 60 * 60, QStringLiteral( "1 hour(s) ago" ) );
testFormatDuration( t0, 2 * 60 * 60, QStringLiteral( "2 hour(s) ago" ) );
testFormatDuration( t0, 1 * DAY_IN_SECS, QStringLiteral( "1 day(s) ago" ) );
testFormatDuration( t0, 2 * DAY_IN_SECS, QStringLiteral( "2 day(s) ago" ) );
testFormatDuration( t0, 7 * DAY_IN_SECS, QStringLiteral( "1 week(s) ago" ) );
testFormatDuration( t0, 14 * DAY_IN_SECS, QStringLiteral( "2 week(s) ago" ) );
testFormatDuration( t0, MONTH_IN_SECS, QStringLiteral( "1 month(s) ago" ) );
testFormatDuration( t0, 2 * MONTH_IN_SECS, QStringLiteral( "2 month(s) ago" ) );
testFormatDuration( t0, 12 * MONTH_IN_SECS, QStringLiteral( "1 year(s) ago" ) );
testFormatDuration( t0, 24 * MONTH_IN_SECS, QStringLiteral( "2 year(s) ago" ) );
}

void TestUtilsFunctions::testFormatDuration( const QDateTime &t0, qint64 diffSecs, const QString &expectedResult )
Expand Down
Loading