diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index fb89e8bcb..e59411aee 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -437,7 +437,7 @@ void BrowserService::removeSharedEncryptionKeys() if (keysToRemove.isEmpty()) { QMessageBox::information(0, tr("KeePassXC: No keys found"), - tr("No shared encryption keys found in KeePassXC Settings."), + tr("No shared encryption keys found in KeePassXC settings."), QMessageBox::Ok); return; } diff --git a/src/core/CsvParser.cpp b/src/core/CsvParser.cpp index 6a963fc45..2032e8f60 100644 --- a/src/core/CsvParser.cpp +++ b/src/core/CsvParser.cpp @@ -84,7 +84,7 @@ bool CsvParser::readFile(QFile *device) { m_array.replace("\r\n", "\n"); m_array.replace("\r", "\n"); if (0 == m_array.size()) - appendStatusMsg(QObject::tr("file empty !\n")); + appendStatusMsg(QObject::tr("file empty").append("\n")); m_isFileLoaded = true; } return m_isFileLoaded; diff --git a/src/core/Database.cpp b/src/core/Database.cpp index 8fe8d04c7..0c2d06b3d 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -477,7 +477,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam FileKey fileKey; QString errorMessage; if (!fileKey.load(keyFilename, &errorMessage)) { - errorTextStream << QObject::tr("Failed to load key file %1 : %2").arg(keyFilename, errorMessage); + errorTextStream << QObject::tr("Failed to load key file %1: %2").arg(keyFilename, errorMessage); errorTextStream << endl; return nullptr; } diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp index adfdea0a7..249807ee1 100644 --- a/src/gui/AboutDialog.cpp +++ b/src/gui/AboutDialog.cpp @@ -53,9 +53,9 @@ AboutDialog::AboutDialog(QWidget* parent) } QString debugInfo = "KeePassXC - "; - debugInfo.append(tr("Version %1\n").arg(KEEPASSX_VERSION)); + debugInfo.append(tr("Version %1").arg(KEEPASSX_VERSION).append("\n")); #ifndef KEEPASSXC_BUILD_TYPE_RELEASE - debugInfo.append(tr("Build Type: %1\n").arg(KEEPASSXC_BUILD_TYPE)); + debugInfo.append(tr("Build Type: %1").arg(KEEPASSXC_BUILD_TYPE).append("\n")); #endif if (!commitHash.isEmpty()) { debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n")); diff --git a/src/gui/ChangeMasterKeyWidget.cpp b/src/gui/ChangeMasterKeyWidget.cpp index 28a0991db..79fd2712b 100644 --- a/src/gui/ChangeMasterKeyWidget.cpp +++ b/src/gui/ChangeMasterKeyWidget.cpp @@ -85,7 +85,7 @@ void ChangeMasterKeyWidget::createKeyFile() QString errorMsg; bool created = FileKey::create(fileName, &errorMsg); if (!created) { - m_ui->messageWidget->showMessage(tr("Unable to create Key File : ").append(errorMsg), MessageWidget::Error); + m_ui->messageWidget->showMessage(tr("Unable to create key file: %1").arg(errorMsg), MessageWidget::Error); } else { m_ui->keyFileCombo->setEditText(fileName); @@ -159,7 +159,7 @@ void ChangeMasterKeyWidget::generateKey() QString fileKeyName = m_ui->keyFileCombo->currentText(); if (!fileKey.load(fileKeyName, &errorMsg)) { m_ui->messageWidget->showMessage( - tr("Failed to set %1 as the Key file:\n%2").arg(fileKeyName, errorMsg), MessageWidget::Error); + tr("Failed to set %1 as the key file:\n%2").arg(fileKeyName, errorMsg), MessageWidget::Error); return; } if (fileKey.type() != FileKey::Hashed) { diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 3af0c6e8f..a93110234 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -214,7 +214,7 @@ QSharedPointer DatabaseOpenWidget::databaseKey() QString keyFilename = m_ui->comboKeyFile->currentText(); QString errorMsg; if (!key.load(keyFilename, &errorMsg)) { - m_ui->messageWidget->showMessage(tr("Can't open key file").append(":\n").append(errorMsg), + m_ui->messageWidget->showMessage(tr("Can't open key file:\n%1").arg(errorMsg), MessageWidget::Error); return QSharedPointer(); } diff --git a/src/gui/DatabaseRepairWidget.cpp b/src/gui/DatabaseRepairWidget.cpp index d3dddf14f..aa9613a25 100644 --- a/src/gui/DatabaseRepairWidget.cpp +++ b/src/gui/DatabaseRepairWidget.cpp @@ -50,7 +50,7 @@ void DatabaseRepairWidget::openDatabase() QString keyFilename = m_ui->comboKeyFile->currentText(); QString errorMsg; if (!key.load(keyFilename, &errorMsg)) { - MessageBox::warning(this, tr("Error"), tr("Can't open key file").append(":\n").append(errorMsg)); + MessageBox::warning(this, tr("Error"), tr("Can't open key file:\n%1").arg(errorMsg)); emit editFinished(false); return; } diff --git a/src/gui/SearchWidget.cpp b/src/gui/SearchWidget.cpp index ed3a50b2a..bf961ecbb 100644 --- a/src/gui/SearchWidget.cpp +++ b/src/gui/SearchWidget.cpp @@ -47,7 +47,7 @@ SearchWidget::SearchWidget(QWidget* parent) m_ui->searchEdit->installEventFilter(this); QMenu* searchMenu = new QMenu(); - m_actionCaseSensitive = searchMenu->addAction(tr("Case Sensitive"), this, SLOT(updateCaseSensitive())); + m_actionCaseSensitive = searchMenu->addAction(tr("Case sensitive"), this, SLOT(updateCaseSensitive())); m_actionCaseSensitive->setObjectName("actionSearchCaseSensitive"); m_actionCaseSensitive->setCheckable(true); diff --git a/src/gui/TotpDialog.cpp b/src/gui/TotpDialog.cpp index 7325d2536..1529db0dc 100644 --- a/src/gui/TotpDialog.cpp +++ b/src/gui/TotpDialog.cpp @@ -72,7 +72,7 @@ void TotpDialog::updateProgressBar() void TotpDialog::updateSeconds() { uint epoch = QDateTime::currentDateTime().toTime_t() - 1; - m_ui->timerLabel->setText(tr("Expires in") + " " + QString::number(m_step - (epoch % m_step)) + " " + tr("seconds")); + m_ui->timerLabel->setText(tr("Expires in %n second(s)", "", m_step - (epoch % m_step))); } void TotpDialog::updateTotp() diff --git a/src/gui/csvImport/CsvImportWidget.cpp b/src/gui/csvImport/CsvImportWidget.cpp index ad56a873b..c2c2aa03e 100644 --- a/src/gui/csvImport/CsvImportWidget.cpp +++ b/src/gui/csvImport/CsvImportWidget.cpp @@ -151,10 +151,10 @@ void CsvImportWidget::updatePreview() { if (m_ui->checkBoxFieldNames->isChecked()) { columnName = m_parserModel->getCsvTable().at(0).at(i); if (columnName.isEmpty()) - columnName = "<" + tr("Empty fieldname ") + QString::number(++emptyId) + ">"; + columnName = "<" + tr("Empty fieldname %1").arg(++emptyId) + ">"; list << columnName; } else { - list << QString(tr("column ")) + QString::number(i); + list << QString(tr("column %1").arg(i)); } } m_comboModel->setStringList(list); @@ -176,7 +176,7 @@ void CsvImportWidget::load(const QString& filename, Database* const db) { m_ui->labelFilename->setText(filename); Group* group = m_db->rootGroup(); group->setUuid(Uuid::random()); - group->setNotes(tr("Imported from CSV file").append("\n").append(tr("Original data: ")) + filename); + group->setNotes(tr("Imported from CSV file\nOriginal data: %1").arg(filename)); parse(); } @@ -188,7 +188,7 @@ void CsvImportWidget::parse() { updatePreview(); QApplication::restoreOverrideCursor(); if (!good) - m_ui->messageWidget->showMessage(tr("Error(s) detected in CSV file !").append("\n") + m_ui->messageWidget->showMessage(tr("Error(s) detected in CSV file!").append("\n") .append(formatStatusText()), MessageWidget::Warning); else m_ui->messageWidget->setHidden(true); @@ -201,8 +201,8 @@ QString CsvImportWidget::formatStatusText() const { int items = text.count('\n'); if (items > 2) { return text.section('\n', 0, 1) - .append("\n[").append(QString::number(items - 2)) - .append(tr(" more messages skipped]")); + .append("\n") + .append(tr("[%n more message(s) skipped]", "", items - 2)); } if (items == 1) { text.append(QString("\n")); @@ -247,8 +247,8 @@ void CsvImportWidget::writeDatabase() { KeePass2Writer writer; writer.writeDatabase(&buffer, m_db); if (writer.hasError()) - MessageBox::warning(this, tr("Error"), tr("CSV import: writer has errors:\n") - .append((writer.errorString())), QMessageBox::Ok, QMessageBox::Ok); + MessageBox::warning(this, tr("Error"), tr("CSV import: writer has errors:\n%1") + .arg(writer.errorString()), QMessageBox::Ok, QMessageBox::Ok); emit editFinished(true); } diff --git a/src/gui/csvImport/CsvParserModel.cpp b/src/gui/csvImport/CsvParserModel.cpp index 29f389df2..eb2793f86 100644 --- a/src/gui/csvImport/CsvParserModel.cpp +++ b/src/gui/csvImport/CsvParserModel.cpp @@ -31,9 +31,10 @@ void CsvParserModel::setFilename(const QString& filename) { } QString CsvParserModel::getFileInfo(){ - QString a(tr("%n byte(s), ", nullptr, getFileSize())); - a.append(tr("%n row(s), ", nullptr, getCsvRows())); - a.append(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))); + QString a(tr("%1, %2, %3", "file info: bytes, rows, columns") + .arg(tr("%n byte(s)", nullptr, getFileSize())) + .arg(tr("%n row(s)", nullptr, getCsvRows())) + .arg(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1)))); return a; } diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 4d12dd16b..4759af7aa 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -916,7 +916,7 @@ void EditEntryWidget::insertAttribute() int i = 1; while (m_entryAttributes->keys().contains(name)) { - name = QString("%1 %2").arg(tr("New attribute")).arg(i); + name = tr("New attribute %1").arg(i); i++; } @@ -979,7 +979,7 @@ void EditEntryWidget::displayAttribute(QModelIndex index, bool showProtected) if (index.isValid()) { QString key = m_attributesModel->keyByIndex(index); if (showProtected) { - m_advancedUi->attributesEdit->setPlainText(tr("[PROTECTED]") + " " + tr("Press reveal to view or edit")); + m_advancedUi->attributesEdit->setPlainText(tr("[PROTECTED] Press reveal to view or edit")); m_advancedUi->attributesEdit->setEnabled(false); m_advancedUi->revealAttributeButton->setEnabled(true); m_advancedUi->protectAttributeButton->setChecked(true); diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp index 16908361a..78b6d741b 100644 --- a/src/gui/entry/EntryAttachmentsWidget.cpp +++ b/src/gui/entry/EntryAttachmentsWidget.cpp @@ -162,7 +162,7 @@ void EntryAttachmentsWidget::removeSelectedAttachments() } const QString question = tr("Are you sure you want to remove %n attachment(s)?", "", indexes.count()); - QMessageBox::StandardButton answer = MessageBox::question(this, tr("Confirm Remove"), + QMessageBox::StandardButton answer = MessageBox::question(this, tr("Confirm remove"), question, QMessageBox::Yes | QMessageBox::No); if (answer == QMessageBox::Yes) { QStringList keys;