From 6be243d3f95927ff9619f64070978f90421834c3 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Tue, 19 Feb 2019 22:13:24 -0500 Subject: [PATCH] Handle plural vs. singular cases in PrintView (#47) --- glabels/PrintView.cpp | 19 +++++++++++++++++-- translations/glabels_C.ts | 8 ++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/glabels/PrintView.cpp b/glabels/PrintView.cpp index 1508d4c..a900af3 100644 --- a/glabels/PrintView.cpp +++ b/glabels/PrintView.cpp @@ -90,8 +90,23 @@ namespace glabels { copiesStartSpin->setRange( 1, mModel->frame()->nLabels() ); - copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on %2 pages.)") - .arg(mRenderer.nItems()).arg(mRenderer.nPages()) ); + if ( mRenderer.nPages() == 1 ) + { + if ( mRenderer.nItems() == 1 ) + { + copiesDescriptionLabel->setText( tr("(Will print a total of 1 item on 1 page.)") ); + } + else + { + copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on 1 page.)") + .arg(mRenderer.nItems()) ); + } + } + else + { + copiesDescriptionLabel->setText( tr("(Will print a total of %1 items on %2 pages.)") + .arg(mRenderer.nItems()).arg(mRenderer.nPages()) ); + } pageSpin->setRange( 1, mRenderer.nPages() ); nPagesLabel->setText( QString::number( mRenderer.nPages() ) ); diff --git a/translations/glabels_C.ts b/translations/glabels_C.ts index e8b655c..1d83063 100644 --- a/translations/glabels_C.ts +++ b/translations/glabels_C.ts @@ -1921,6 +1921,14 @@ (Will print a total of %1 items on %2 pages.) + + (Will print a total of 1 item on 1 page.) + + + + (Will print a total of %1 items on 1 page.) + + glabels::PropertiesView