Fix plural word issues in status message

This commit is contained in:
Jean-Francois Dockes 2019-07-22 11:26:39 +02:00
parent c18f069c58
commit 99ee4d456c

View File

@ -55,20 +55,22 @@ void RclMain::updateIdxStatus()
} }
msg += phs + " "; msg += phs + " ";
if (status.phase == DbIxStatus::DBIXS_FILES) { if (status.phase == DbIxStatus::DBIXS_FILES) {
char cnts[100]; QString sdocs = status.docsdone > 1 ?tr("documents") : tr("document");
QString sfiles = status.filesdone > 1 ? tr("files") : tr("file");
QString serrors = status.fileerrors > 1 ? tr("errors") : tr("error");
QString stats;
if (status.dbtotdocs > 0) { if (status.dbtotdocs > 0) {
string format = stats = QString("(%1 ") + sdocs + "/%2 " + sfiles +
qs2utf8s(tr("(%d documents/%d files/%d errors/%d total files) ")); "/%3 " + serrors + "/%4 " + tr("total files)");
sprintf(cnts, format.c_str(), stats = stats.arg(status.docsdone).arg(status.filesdone).
status.docsdone, status.filesdone, status.fileerrors, arg(status.fileerrors).arg(status.totfiles);
status.totfiles);
} else { } else {
string format = stats = QString("(%1 ") + sdocs + "/%2 " + sfiles +
qs2utf8s(tr("(%d documents/%d files/%d errors) ")); "/%3 " + serrors + ") ";
sprintf(cnts, format.c_str(), stats = stats.arg(status.docsdone).arg(status.filesdone).
status.docsdone, status.filesdone, status.fileerrors); arg(status.fileerrors);
} }
msg += QString::fromUtf8(cnts) + " "; msg += stats + " ";
} }
string mf;int ecnt = 0; string mf;int ecnt = 0;
string fcharset = theconfig->getDefCharset(true); string fcharset = theconfig->getDefCharset(true);