Update base translations and improve consistency (#12432)

* Improve confirmation prompts and tooltips for delete actions in the GUI

* Fixes #10543
This commit is contained in:
Jonathan White 2025-09-07 20:16:36 -04:00 committed by GitHub
parent b12f6f0786
commit 7ea141652e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 250 additions and 176 deletions

View file

@ -1120,8 +1120,8 @@ void DatabaseWidget::deleteGroup()
if (inRecycleBin || isRecycleBin || isRecycleBinSubgroup || !m_db->metadata()->recycleBinEnabled()) {
auto result = MessageBox::question(
this,
tr("Delete group"),
tr("Do you really want to delete the group \"%1\" for good?").arg(currentGroup->name().toHtmlEscaped()),
tr("Confirm Delete Group"),
tr("Do you really want to permanently delete the group \"%1\"?").arg(currentGroup->name().toHtmlEscaped()),
MessageBox::Delete | MessageBox::Cancel,
MessageBox::Cancel);
@ -1130,7 +1130,7 @@ void DatabaseWidget::deleteGroup()
}
} else {
auto result = MessageBox::question(this,
tr("Move group to recycle bin?"),
tr("Confirm Recycle Group"),
tr("Do you really want to move the group "
"\"%1\" to the recycle bin?")
.arg(currentGroup->name().toHtmlEscaped()),
@ -2640,7 +2640,7 @@ bool DatabaseWidget::saveBackup()
}
const QString newFilePath = fileDialog()->getSaveFileName(this,
tr("Save database backup"),
tr("Save Database Backup"),
FileDialog::getLastDir("backup", oldFilePath),
tr("KeePass 2 Database").append(" (*.kdbx)"));

View file

@ -32,14 +32,15 @@ namespace GuiTools
if (permanent) {
QString prompt;
if (entries.size() == 1) {
prompt = QObject::tr("Do you really want to delete the entry \"%1\" for good?")
.arg(entries.first()->title().toHtmlEscaped());
auto entry = entries.first();
prompt = QObject::tr("Do you really want to permanently delete the entry \"%1\"?")
.arg(entry->resolvePlaceholder(entry->title()).toHtmlEscaped());
} else {
prompt = QObject::tr("Do you really want to delete %n entry(s) for good?", "", entries.size());
prompt = QObject::tr("Do you really want to permanently delete %n entry(s)?", "", entries.size());
}
auto answer = MessageBox::question(parent,
QObject::tr("Delete entry(s)?", "", entries.size()),
QObject::tr("Confirm Delete Entry(s)", "", entries.size()),
prompt,
MessageBox::Delete | MessageBox::Cancel,
MessageBox::Cancel);
@ -50,14 +51,15 @@ namespace GuiTools
} else {
QString prompt;
if (entries.size() == 1) {
auto entry = entries.first();
prompt = QObject::tr("Do you really want to move entry \"%1\" to the recycle bin?")
.arg(entries.first()->title().toHtmlEscaped());
.arg(entry->resolvePlaceholder(entry->title()).toHtmlEscaped());
} else {
prompt = QObject::tr("Do you really want to move %n entry(s) to the recycle bin?", "", entries.size());
}
auto answer = MessageBox::question(parent,
QObject::tr("Move entry(s) to recycle bin?", "", entries.size()),
QObject::tr("Confirm Recycle Entry(s)", "", entries.size()),
prompt,
MessageBox::Move | MessageBox::Cancel,
MessageBox::Cancel);
@ -72,11 +74,12 @@ namespace GuiTools
return false;
}
auto answer = MessageBox::question(parent,
QObject::tr("Delete plugin data?"),
QObject::tr("Delete plugin data from Entry(s)?", "", entries.size()),
MessageBox::Delete | MessageBox::Cancel,
MessageBox::Cancel);
auto answer =
MessageBox::question(parent,
QObject::tr("Confirm Delete Plugin Data"),
QObject::tr("Delete plugin data from the selected entry(s)?", "", entries.size()),
MessageBox::Delete | MessageBox::Cancel,
MessageBox::Cancel);
return answer == MessageBox::Delete;
}
@ -100,7 +103,7 @@ namespace GuiTools
// Prompt the user on what to do with the reference (Overwrite, Delete, Skip)
auto result = MessageBox::question(
parent,
QObject::tr("Replace references to entry?"),
QObject::tr("Confirm Replace Entry References"),
QObject::tr(
"Entry \"%1\" has %2 reference(s). "
"Do you want to overwrite references with values, skip this entry, or delete anyway?",

View file

@ -944,6 +944,17 @@ void MainWindow::updateMenuActionState()
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
m_ui->actionEntryExpire->setEnabled(multiEntrySelected);
m_ui->actionEntryDelete->setEnabled(multiEntrySelected);
if (dbWidget) {
if (dbWidget->database()->metadata()->recycleBinEnabled() && !inRecycleBin) {
m_ui->actionEntryDelete->setToolTip(
tr("Move selected entry(s) to the recycle bin", "", dbWidget->numberOfSelectedEntries()));
} else {
m_ui->actionEntryDelete->setToolTip(
tr("Permanently delete the selected entry(s)", "", dbWidget->numberOfSelectedEntries()));
}
} else {
m_ui->actionEntryDelete->setToolTip(tr("Delete Entry"));
}
m_ui->actionEntryRestore->setVisible(multiEntrySelected && inRecycleBin);
m_ui->actionEntryRestore->setEnabled(multiEntrySelected && inRecycleBin);
if (dbWidget) {

View file

@ -532,7 +532,7 @@
<string>&amp;New Entry…</string>
</property>
<property name="toolTip">
<string>Create Entry</string>
<string>New Entry</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+N</string>
@ -542,6 +542,9 @@
<property name="text">
<string>&amp;Edit Entry…</string>
</property>
<property name="iconText">
<string>Edit Entry…</string>
</property>
<property name="toolTip">
<string>Edit Entry</string>
</property>
@ -554,12 +557,21 @@
<bool>false</bool>
</property>
<property name="text">
<string>E&amp;xpire Entry…</string>
<string>E&amp;xpire Entry</string>
</property>
<property name="iconText">
<string>Expire Entry</string>
</property>
<property name="toolTip">
<string>Expire Entry</string>
</property>
</action>
<action name="actionEntryDelete">
<property name="text">
<string>&amp;Delete Entry…</string>
<string>&amp;Delete Entry</string>
</property>
<property name="iconText">
<string>Delete Entry</string>
</property>
<property name="toolTip">
<string>Delete Entry</string>

View file

@ -1690,21 +1690,21 @@ void EditEntryWidget::deleteAllHistoryEntries()
QMenu* EditEntryWidget::createPresetsMenu()
{
auto* expirePresetsMenu = new QMenu(this);
expirePresetsMenu->addAction(tr("%n hour(s)", nullptr, 12))->setData(QVariant::fromValue(TimeDelta::fromHours(12)));
expirePresetsMenu->addAction(tr("%n hour(s)", nullptr, 24))->setData(QVariant::fromValue(TimeDelta::fromHours(24)));
expirePresetsMenu->addAction(tr("%n hour(s)", "", 12))->setData(QVariant::fromValue(TimeDelta::fromHours(12)));
expirePresetsMenu->addAction(tr("%n hour(s)", "", 24))->setData(QVariant::fromValue(TimeDelta::fromHours(24)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 1))->setData(QVariant::fromValue(TimeDelta::fromDays(7)));
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 2))->setData(QVariant::fromValue(TimeDelta::fromDays(14)));
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 3))->setData(QVariant::fromValue(TimeDelta::fromDays(21)));
expirePresetsMenu->addAction(tr("%n week(s)", "", 1))->setData(QVariant::fromValue(TimeDelta::fromDays(7)));
expirePresetsMenu->addAction(tr("%n week(s)", "", 2))->setData(QVariant::fromValue(TimeDelta::fromDays(14)));
expirePresetsMenu->addAction(tr("%n week(s)", "", 3))->setData(QVariant::fromValue(TimeDelta::fromDays(21)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 1))->setData(QVariant::fromValue(TimeDelta::fromMonths(1)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 2))->setData(QVariant::fromValue(TimeDelta::fromMonths(2)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 3))->setData(QVariant::fromValue(TimeDelta::fromMonths(3)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 6))->setData(QVariant::fromValue(TimeDelta::fromMonths(6)));
expirePresetsMenu->addAction(tr("%n month(s)", "", 1))->setData(QVariant::fromValue(TimeDelta::fromMonths(1)));
expirePresetsMenu->addAction(tr("%n month(s)", "", 2))->setData(QVariant::fromValue(TimeDelta::fromMonths(2)));
expirePresetsMenu->addAction(tr("%n month(s)", "", 3))->setData(QVariant::fromValue(TimeDelta::fromMonths(3)));
expirePresetsMenu->addAction(tr("%n month(s)", "", 6))->setData(QVariant::fromValue(TimeDelta::fromMonths(6)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n year(s)", nullptr, 1))->setData(QVariant::fromValue(TimeDelta::fromYears(1)));
expirePresetsMenu->addAction(tr("%n year(s)", nullptr, 2))->setData(QVariant::fromValue(TimeDelta::fromYears(2)));
expirePresetsMenu->addAction(tr("%n year(s)", nullptr, 3))->setData(QVariant::fromValue(TimeDelta::fromYears(3)));
expirePresetsMenu->addAction(tr("%n year(s)", "", 1))->setData(QVariant::fromValue(TimeDelta::fromYears(1)));
expirePresetsMenu->addAction(tr("%n year(s)", "", 2))->setData(QVariant::fromValue(TimeDelta::fromYears(2)));
expirePresetsMenu->addAction(tr("%n year(s)", "", 3))->setData(QVariant::fromValue(TimeDelta::fromYears(3)));
return expirePresetsMenu;
}

View file

@ -548,7 +548,7 @@ void EntryView::startDrag(Qt::DropActions supportedActions)
for (auto& index : selectedIndexes) {
if (++i > 4) {
int remaining = selectedIndexes.size() - i + 1;
listWidget.addItem(tr("+ %1 entry(s)...", nullptr, remaining).arg(remaining));
listWidget.addItem(tr("+ %1 entry(s)...", "", remaining).arg(remaining));
break;
}

View file

@ -55,8 +55,10 @@ QString ExportDialog::getStrategyName(ExportSortingStrategy strategy)
return tr("name (ascending)");
case ExportSortingStrategy::BY_NAME_DESC:
return tr("name (descending)");
default:
Q_ASSERT(false);
return tr("invalid sort order");
}
return tr("unknown");
}
void ExportDialog::exportDatabase()

View file

@ -76,7 +76,7 @@ void PasskeyExporter::exportSelectedEntry(const Entry* entry, const QString& fol
const auto fullPath = QString("%1/%2.passkey").arg(folder, Tools::cleanFilename(entry->title()));
if (QFile::exists(fullPath)) {
auto dialogResult = MessageBox::warning(m_parent,
tr("KeePassXC: Passkey Export"),
tr("Overwrite Existing File?"),
tr("File \"%1.passkey\" already exists.\n"
"Do you want to overwrite it?\n")
.arg(entry->title()),

View file

@ -39,7 +39,7 @@ void PasskeyImporter::importPasskey(QSharedPointer<Database>& database, Entry* e
{
auto filter = QString("%1 (*.passkey);;%2 (*)").arg(tr("Passkey file"), tr("All files"));
auto fileName =
fileDialog()->getOpenFileName(m_parent, tr("Open passkey file"), FileDialog::getLastDir("passkey"), filter);
fileDialog()->getOpenFileName(m_parent, tr("Open Passkey File"), FileDialog::getLastDir("passkey"), filter);
if (fileName.isEmpty()) {
return;
}
@ -62,7 +62,7 @@ void PasskeyImporter::importSelectedFile(QFile& file, QSharedPointer<Database>&
const auto passkeyObject = browserMessageBuilder()->getJsonObject(fileData);
if (passkeyObject.isEmpty()) {
MessageBox::information(m_parent,
tr("Cannot import passkey"),
tr("Passkey Import Failed"),
tr("Cannot import passkey file \"%1\". Data is missing.").arg(file.fileName()));
return;
}
@ -73,14 +73,14 @@ void PasskeyImporter::importSelectedFile(QFile& file, QSharedPointer<Database>&
QStringList() << "relyingParty" << "url" << "username" << "credentialId" << "userHandle" << "privateKey");
if (!missingKeys.isEmpty()) {
MessageBox::information(m_parent,
tr("Cannot import passkey"),
tr("Passkey Import Failed"),
tr("Cannot import passkey file \"%1\".\nThe following data is missing:\n%2")
.arg(file.fileName(), missingKeys.join(", ")));
} else if (!privateKey.startsWith(EntryAttributes::KPEX_PASSKEY_PRIVATE_KEY_START)
|| !privateKey.trimmed().endsWith(EntryAttributes::KPEX_PASSKEY_PRIVATE_KEY_END)) {
MessageBox::information(
m_parent,
tr("Cannot import passkey"),
tr("Passkey Import Failed"),
tr("Cannot import passkey file \"%1\". Private key is missing or malformed.").arg(file.fileName()));
} else {
const auto relyingParty = passkeyObject["relyingParty"].toString();

View file

@ -122,7 +122,7 @@ void ReportsWidgetStatistics::calculateStats()
tr("Excluding entries from reports, e. g. because they are known to have a poor password, isn't "
"necessarily a problem but you should keep an eye on them."));
addStatsRow(tr("Average password length"),
tr("%1 characters").arg(stats->averagePwdLength()),
tr("%1 character(s)", "", stats->averagePwdLength()).arg(stats->averagePwdLength()),
stats->isAvgPwdTooShort(),
tr("Average password length is less than ten characters. Longer passwords provide more security."));
}