Merge pull request #1725 from Throne3d/fix/1647-translations

Improve translation base strings
This commit is contained in:
Janek Bevendorff 2018-03-18 00:01:27 +01:00 committed by GitHub
commit ed2da34d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 81 additions and 82 deletions

View File

@ -130,9 +130,9 @@ void BrowserOptionDialog::saveSettings()
void BrowserOptionDialog::showProxyLocationFileDialog() void BrowserOptionDialog::showProxyLocationFileDialog()
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QString fileTypeFilter(tr("Executable Files (*.exe);;All Files (*.*)")); QString fileTypeFilter(QString("%1 (*.exe);;%2 (*.*)").arg(tr("Executable Files"), tr("All Files")));
#else #else
QString fileTypeFilter(tr("Executable Files (*)")); QString fileTypeFilter(QString("%1 (*)").arg(tr("Executable Files")));
#endif #endif
auto proxyLocation = QFileDialog::getOpenFileName(this, tr("Select custom proxy location"), auto proxyLocation = QFileDialog::getOpenFileName(this, tr("Select custom proxy location"),
QFileInfo(QCoreApplication::applicationDirPath()).filePath(), QFileInfo(QCoreApplication::applicationDirPath()).filePath(),

View File

@ -437,7 +437,7 @@ void BrowserService::removeSharedEncryptionKeys()
if (keysToRemove.isEmpty()) { if (keysToRemove.isEmpty()) {
QMessageBox::information(0, tr("KeePassXC: No keys found"), 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); QMessageBox::Ok);
return; return;
} }

View File

@ -84,7 +84,7 @@ bool CsvParser::readFile(QFile *device) {
m_array.replace("\r\n", "\n"); m_array.replace("\r\n", "\n");
m_array.replace("\r", "\n"); m_array.replace("\r", "\n");
if (0 == m_array.size()) if (0 == m_array.size())
appendStatusMsg(QObject::tr("file empty !\n")); appendStatusMsg(QObject::tr("file empty").append("\n"));
m_isFileLoaded = true; m_isFileLoaded = true;
} }
return m_isFileLoaded; return m_isFileLoaded;
@ -377,10 +377,8 @@ int CsvParser::getCsvRows() const {
void CsvParser::appendStatusMsg(QString s, bool isCritical) { void CsvParser::appendStatusMsg(QString s, bool isCritical) {
m_statusMsg += s m_statusMsg += QObject::tr("%1: (row, col) %2,%3")
.append(": (row,col) " + QString::number(m_currRow)) .arg(s, m_currRow, m_currCol)
.append(",")
.append(QString::number(m_currCol))
.append("\n"); .append("\n");
m_isGood = !isCritical; m_isGood = !isCritical;
} }

View File

@ -477,7 +477,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam
FileKey fileKey; FileKey fileKey;
QString errorMessage; QString errorMessage;
if (!fileKey.load(keyFilename, &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; errorTextStream << endl;
return nullptr; return nullptr;
} }

View File

@ -681,7 +681,7 @@ Entry* Entry::clone(CloneFlags flags) const
} }
if (flags & CloneRenameTitle) if (flags & CloneRenameTitle)
entry->setTitle(entry->title() + tr(" - Clone", "Suffix added to cloned entries")); entry->setTitle(tr("%1 - Clone").arg(entry->title()));
return entry; return entry;
} }

View File

@ -616,7 +616,7 @@ QString Group::print(bool recursive, int depth)
QString indentation = QString(" ").repeated(depth); QString indentation = QString(" ").repeated(depth);
if (entries().isEmpty() && children().isEmpty()) { if (entries().isEmpty() && children().isEmpty()) {
response += indentation + "[empty]\n"; response += indentation + tr("[empty]", "group has no children") + "\n";
return response; return response;
} }
@ -911,7 +911,7 @@ void Group::markOlderEntry(Entry* entry)
{ {
entry->attributes()->set( entry->attributes()->set(
"merged", "merged",
QString("older entry merged from database \"%1\"").arg(entry->group()->database()->metadata()->name())); tr("older entry merged from database \"%1\"").arg(entry->group()->database()->metadata()->name()));
} }
bool Group::resolveSearchingEnabled() const bool Group::resolveSearchingEnabled() const

View File

@ -42,7 +42,7 @@ Database* Kdbx3Reader::readDatabaseImpl(QIODevice* device, const QByteArray& hea
if (m_masterSeed.isEmpty() || m_encryptionIV.isEmpty() if (m_masterSeed.isEmpty() || m_encryptionIV.isEmpty()
|| m_streamStartBytes.isEmpty() || m_protectedStreamKey.isEmpty() || m_streamStartBytes.isEmpty() || m_protectedStreamKey.isEmpty()
|| m_db->cipher().isNull()) { || m_db->cipher().isNull()) {
raiseError("missing database headers"); raiseError(tr("missing database headers"));
return nullptr; return nullptr;
} }
@ -134,7 +134,7 @@ Database* Kdbx3Reader::readDatabaseImpl(QIODevice* device, const QByteArray& hea
if (!xmlReader.headerHash().isEmpty()) { if (!xmlReader.headerHash().isEmpty()) {
QByteArray headerHash = CryptoHash::hash(headerData, CryptoHash::Sha256); QByteArray headerHash = CryptoHash::hash(headerData, CryptoHash::Sha256);
if (headerHash != xmlReader.headerHash()) { if (headerHash != xmlReader.headerHash()) {
raiseError("Header doesn't match hash"); raiseError(tr("Header doesn't match hash"));
return nullptr; return nullptr;
} }
} }
@ -146,7 +146,7 @@ bool Kdbx3Reader::readHeaderField(StoreDataStream& headerStream)
{ {
QByteArray fieldIDArray = headerStream.read(1); QByteArray fieldIDArray = headerStream.read(1);
if (fieldIDArray.size() != 1) { if (fieldIDArray.size() != 1) {
raiseError("Invalid header id size"); raiseError(tr("Invalid header id size"));
return false; return false;
} }
char fieldID = fieldIDArray.at(0); char fieldID = fieldIDArray.at(0);
@ -154,7 +154,7 @@ bool Kdbx3Reader::readHeaderField(StoreDataStream& headerStream)
bool ok; bool ok;
auto fieldLen = Endian::readSizedInt<quint16>(&headerStream, KeePass2::BYTEORDER, &ok); auto fieldLen = Endian::readSizedInt<quint16>(&headerStream, KeePass2::BYTEORDER, &ok);
if (!ok) { if (!ok) {
raiseError("Invalid header field length"); raiseError(tr("Invalid header field length"));
return false; return false;
} }
@ -162,7 +162,7 @@ bool Kdbx3Reader::readHeaderField(StoreDataStream& headerStream)
if (fieldLen != 0) { if (fieldLen != 0) {
fieldData = headerStream.read(fieldLen); fieldData = headerStream.read(fieldLen);
if (fieldData.size() != fieldLen) { if (fieldData.size() != fieldLen) {
raiseError("Invalid header data length"); raiseError(tr("Invalid header data length"));
return false; return false;
} }
} }

View File

@ -179,8 +179,9 @@ QString KdbxXmlReader::errorString() const
{ {
if (m_error) { if (m_error) {
return m_errorStr; return m_errorStr;
}if (m_xml.hasError()) { }
return QString("XML error:\n%1\nLine %2, column %3") if (m_xml.hasError()) {
return tr("XML error:\n%1\nLine %2, column %3")
.arg(m_xml.errorString()) .arg(m_xml.errorString())
.arg(m_xml.lineNumber()) .arg(m_xml.lineNumber())
.arg(m_xml.columnNumber()); .arg(m_xml.columnNumber());

View File

@ -363,7 +363,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
cipherStream->reset(); cipherStream->reset();
cipherStream->close(); cipherStream->close();
if (!m_device->seek(contentPos)) { if (!m_device->seek(contentPos)) {
QString msg = "unable to seek to content position"; QString msg = tr("unable to seek to content position");
if (!m_device->errorString().isEmpty()) { if (!m_device->errorString().isEmpty()) {
msg.append("\n").append(m_device->errorString()); msg.append("\n").append(m_device->errorString());
} }

View File

@ -53,9 +53,9 @@ AboutDialog::AboutDialog(QWidget* parent)
} }
QString debugInfo = "KeePassXC - "; 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 #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 #endif
if (!commitHash.isEmpty()) { if (!commitHash.isEmpty()) {
debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n")); debugInfo.append(tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
@ -82,23 +82,23 @@ AboutDialog::AboutDialog(QWidget* parent)
QString extensions; QString extensions;
#ifdef WITH_XC_AUTOTYPE #ifdef WITH_XC_AUTOTYPE
extensions += "\n- Auto-Type"; extensions += "\n- " + tr("Auto-Type");
#endif #endif
#ifdef WITH_XC_BROWSER #ifdef WITH_XC_BROWSER
extensions += "\n- Browser Integration"; extensions += "\n- " + tr("Browser Integration");
#endif #endif
#ifdef WITH_XC_HTTP #ifdef WITH_XC_HTTP
extensions += "\n- Legacy Browser Integration (KeePassHTTP)"; extensions += "\n- " + tr("Legacy Browser Integration (KeePassHTTP)");
#endif #endif
#ifdef WITH_XC_SSHAGENT #ifdef WITH_XC_SSHAGENT
extensions += "\n- SSH Agent"; extensions += "\n- " + tr("SSH Agent");
#endif #endif
#ifdef WITH_XC_YUBIKEY #ifdef WITH_XC_YUBIKEY
extensions += "\n- YubiKey"; extensions += "\n- " + tr("YubiKey");
#endif #endif
if (extensions.isEmpty()) if (extensions.isEmpty())
extensions = " None"; extensions = " " + tr("None");
debugInfo.append(tr("Enabled extensions:").append(extensions)); debugInfo.append(tr("Enabled extensions:").append(extensions));

View File

@ -85,7 +85,7 @@ void ChangeMasterKeyWidget::createKeyFile()
QString errorMsg; QString errorMsg;
bool created = FileKey::create(fileName, &errorMsg); bool created = FileKey::create(fileName, &errorMsg);
if (!created) { 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 { else {
m_ui->keyFileCombo->setEditText(fileName); m_ui->keyFileCombo->setEditText(fileName);
@ -159,7 +159,7 @@ void ChangeMasterKeyWidget::generateKey()
QString fileKeyName = m_ui->keyFileCombo->currentText(); QString fileKeyName = m_ui->keyFileCombo->currentText();
if (!fileKey.load(fileKeyName, &errorMsg)) { if (!fileKey.load(fileKeyName, &errorMsg)) {
m_ui->messageWidget->showMessage( 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; return;
} }
if (fileKey.type() != FileKey::Hashed) { if (fileKey.type() != FileKey::Hashed) {

View File

@ -214,7 +214,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
QString keyFilename = m_ui->comboKeyFile->currentText(); QString keyFilename = m_ui->comboKeyFile->currentText();
QString errorMsg; QString errorMsg;
if (!key.load(keyFilename, &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); MessageWidget::Error);
return QSharedPointer<CompositeKey>(); return QSharedPointer<CompositeKey>();
} }

View File

@ -50,7 +50,7 @@ void DatabaseRepairWidget::openDatabase()
QString keyFilename = m_ui->comboKeyFile->currentText(); QString keyFilename = m_ui->comboKeyFile->currentText();
QString errorMsg; QString errorMsg;
if (!key.load(keyFilename, &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); emit editFinished(false);
return; return;
} }

View File

@ -181,8 +181,9 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
void DatabaseTabWidget::importCsv() void DatabaseTabWidget::importCsv()
{ {
QString filter = QString("%1 (*.csv);;%2 (*)").arg(tr("CSV file"), tr("All files"));
QString fileName = fileDialog()->getOpenFileName(this, tr("Open CSV file"), QString(), QString fileName = fileDialog()->getOpenFileName(this, tr("Open CSV file"), QString(),
tr("CSV file") + " (*.csv);;" + tr("All files (*)")); filter);
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
return; return;
@ -213,8 +214,9 @@ void DatabaseTabWidget::mergeDatabase(const QString& fileName)
void DatabaseTabWidget::importKeePass1Database() void DatabaseTabWidget::importKeePass1Database()
{ {
QString filter = QString("%1 (*.kdb);;%2 (*)").arg(tr("KeePass 1 database"), tr("All files"));
QString fileName = fileDialog()->getOpenFileName(this, tr("Open KeePass 1 database"), QString(), QString fileName = fileDialog()->getOpenFileName(this, tr("Open KeePass 1 database"), QString(),
tr("KeePass 1 database") + " (*.kdb);;" + tr("All files (*)")); filter);
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
return; return;
@ -532,12 +534,12 @@ void DatabaseTabWidget::updateTabName(Database* db)
if (db->metadata()->name().isEmpty()) { if (db->metadata()->name().isEmpty()) {
tabName = tr("New database"); tabName = tr("New database");
} else { } else {
tabName = QString("%1 [%2]").arg(db->metadata()->name(), tr("New database")); tabName = tr("%1 [New database]", "tab modifier").arg(db->metadata()->name());
} }
} }
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::LockedMode) { if (dbStruct.dbWidget->currentMode() == DatabaseWidget::LockedMode) {
tabName.append(QString(" [%1]").arg(tr("locked"))); tabName = tr("%1 [locked]", "tab modifier").arg(tabName);
} }
if (dbStruct.modified) { if (dbStruct.modified) {

View File

@ -479,23 +479,21 @@ void DatabaseWidget::deleteEntries()
bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first()); bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first());
if (inRecycleBin || !m_db->metadata()->recycleBinEnabled()) { if (inRecycleBin || !m_db->metadata()->recycleBinEnabled()) {
QMessageBox::StandardButton result; QString prompt;
if (selected.size() == 1) { if (selected.size() == 1) {
result = MessageBox::question( prompt = tr("Do you really want to delete the entry \"%1\" for good?")
this, tr("Delete entry?"), .arg(selectedEntries.first()->title().toHtmlEscaped());
tr("Do you really want to delete the entry \"%1\" for good?")
.arg(selectedEntries.first()->title().toHtmlEscaped()),
QMessageBox::Yes | QMessageBox::No);
} }
else { else {
result = MessageBox::question( prompt = tr("Do you really want to delete %n entry(s) for good?", "", selected.size());
this, tr("Delete entries?"),
tr("Do you really want to delete %1 entries for good?")
.arg(selected.size()),
QMessageBox::Yes | QMessageBox::No);
} }
QMessageBox::StandardButton result = MessageBox::question(
this,
tr("Delete entry(s)?", "", selected.size()),
prompt,
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
for (Entry* entry : asConst(selectedEntries)) { for (Entry* entry : asConst(selectedEntries)) {
delete entry; delete entry;
@ -504,22 +502,20 @@ void DatabaseWidget::deleteEntries()
} }
} }
else { else {
QMessageBox::StandardButton result; QString prompt;
if (selected.size() == 1) { if (selected.size() == 1) {
result = MessageBox::question( prompt = tr("Do you really want to move entry \"%1\" to the recycle bin?")
this, tr("Move entry to recycle bin?"), .arg(selectedEntries.first()->title().toHtmlEscaped());
tr("Do you really want to move entry \"%1\" to the recycle bin?") } else {
.arg(selectedEntries.first()->title().toHtmlEscaped()), prompt = tr("Do you really want to move %n entry(s) to the recycle bin?", "", selected.size());
QMessageBox::Yes | QMessageBox::No);
}
else {
result = MessageBox::question(
this, tr("Move entries to recycle bin?"),
tr("Do you really want to move %n entry(s) to the recycle bin?", 0, selected.size()),
QMessageBox::Yes | QMessageBox::No);
} }
QMessageBox::StandardButton result = MessageBox::question(
this,
tr("Move entry(s) to recycle bin?", "", selected.size()),
prompt,
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::No) { if (result == QMessageBox::No) {
return; return;
} }

View File

@ -216,7 +216,7 @@ void DetailsWidget::updateEntryAttributesTab()
if (m_currentEntry->attributes()->isProtected(key)) { if (m_currentEntry->attributes()->isProtected(key)) {
value = "<i>" + tr("[PROTECTED]") + "</i>"; value = "<i>" + tr("[PROTECTED]") + "</i>";
} }
attributesText.append(QString("<b>%1</b>: %2<br/>").arg(key, value)); attributesText.append(tr("<b>%1</b>: %2", "attributes line").arg(key, value).append("<br/>"));
} }
m_ui->entryAttributesEdit->setText(attributesText); m_ui->entryAttributesEdit->setText(attributesText);
} }

View File

@ -305,9 +305,10 @@ void EditWidgetIcons::removeCustomIcon()
int iconUseCount = entriesWithSameIcon.size() + groupsWithSameIcon.size(); int iconUseCount = entriesWithSameIcon.size() + groupsWithSameIcon.size();
if (iconUseCount > 0) { if (iconUseCount > 0) {
QMessageBox::StandardButton ans = MessageBox::question(this, tr("Confirm Delete"), QMessageBox::StandardButton ans = MessageBox::question(this, tr("Confirm Delete"),
tr("This icon is used by %1 entries, and will be replaced " tr("This icon is used by %n entry(s), and will be replaced "
"by the default icon. Are you sure you want to delete it?") "by the default icon. Are you sure you want to delete it?",
.arg(iconUseCount), QMessageBox::Yes | QMessageBox::No); "", iconUseCount),
QMessageBox::Yes | QMessageBox::No);
if (ans == QMessageBox::No) { if (ans == QMessageBox::No) {
// Early out, nothing is changed // Early out, nothing is changed

View File

@ -673,7 +673,7 @@ void MainWindow::updateWindowTitle()
customWindowTitlePart.remove(customWindowTitlePart.size() - 1, 1); customWindowTitlePart.remove(customWindowTitlePart.size() - 1, 1);
} }
if (m_ui->tabWidget->readOnly(tabWidgetIndex)) { if (m_ui->tabWidget->readOnly(tabWidgetIndex)) {
customWindowTitlePart.append(QString(" [%1]").arg(tr("read-only"))); customWindowTitlePart = tr("%1 [read-only]", "window title modifier").arg(customWindowTitlePart);
} }
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex)); m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
} else if (stackedWidgetIndex == 1) { } else if (stackedWidgetIndex == 1) {

View File

@ -47,7 +47,7 @@ SearchWidget::SearchWidget(QWidget* parent)
m_ui->searchEdit->installEventFilter(this); m_ui->searchEdit->installEventFilter(this);
QMenu* searchMenu = new QMenu(); 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->setObjectName("actionSearchCaseSensitive");
m_actionCaseSensitive->setCheckable(true); m_actionCaseSensitive->setCheckable(true);

View File

@ -72,7 +72,7 @@ void TotpDialog::updateProgressBar()
void TotpDialog::updateSeconds() void TotpDialog::updateSeconds()
{ {
uint epoch = QDateTime::currentDateTime().toTime_t() - 1; uint epoch = QDateTime::currentDateTime().toTime_t() - 1;
m_ui->timerLabel->setText(tr("Expires in") + " <b>" + QString::number(m_step - (epoch % m_step)) + "</b> " + tr("seconds")); m_ui->timerLabel->setText(tr("Expires in <b>%n</b> second(s)", "", m_step - (epoch % m_step)));
} }
void TotpDialog::updateTotp() void TotpDialog::updateTotp()

View File

@ -151,10 +151,10 @@ void CsvImportWidget::updatePreview() {
if (m_ui->checkBoxFieldNames->isChecked()) { if (m_ui->checkBoxFieldNames->isChecked()) {
columnName = m_parserModel->getCsvTable().at(0).at(i); columnName = m_parserModel->getCsvTable().at(0).at(i);
if (columnName.isEmpty()) if (columnName.isEmpty())
columnName = "<" + tr("Empty fieldname ") + QString::number(++emptyId) + ">"; columnName = "<" + tr("Empty fieldname %1").arg(++emptyId) + ">";
list << columnName; list << columnName;
} else { } else {
list << QString(tr("column ")) + QString::number(i); list << QString(tr("column %1").arg(i));
} }
} }
m_comboModel->setStringList(list); m_comboModel->setStringList(list);
@ -176,7 +176,7 @@ void CsvImportWidget::load(const QString& filename, Database* const db) {
m_ui->labelFilename->setText(filename); m_ui->labelFilename->setText(filename);
Group* group = m_db->rootGroup(); Group* group = m_db->rootGroup();
group->setUuid(Uuid::random()); 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(); parse();
} }
@ -188,7 +188,7 @@ void CsvImportWidget::parse() {
updatePreview(); updatePreview();
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if (!good) 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); .append(formatStatusText()), MessageWidget::Warning);
else else
m_ui->messageWidget->setHidden(true); m_ui->messageWidget->setHidden(true);
@ -201,8 +201,8 @@ QString CsvImportWidget::formatStatusText() const {
int items = text.count('\n'); int items = text.count('\n');
if (items > 2) { if (items > 2) {
return text.section('\n', 0, 1) return text.section('\n', 0, 1)
.append("\n[").append(QString::number(items - 2)) .append("\n")
.append(tr(" more messages skipped]")); .append(tr("[%n more message(s) skipped]", "", items - 2));
} }
if (items == 1) { if (items == 1) {
text.append(QString("\n")); text.append(QString("\n"));
@ -247,8 +247,8 @@ void CsvImportWidget::writeDatabase() {
KeePass2Writer writer; KeePass2Writer writer;
writer.writeDatabase(&buffer, m_db); writer.writeDatabase(&buffer, m_db);
if (writer.hasError()) if (writer.hasError())
MessageBox::warning(this, tr("Error"), tr("CSV import: writer has errors:\n") MessageBox::warning(this, tr("Error"), tr("CSV import: writer has errors:\n%1")
.append((writer.errorString())), QMessageBox::Ok, QMessageBox::Ok); .arg(writer.errorString()), QMessageBox::Ok, QMessageBox::Ok);
emit editFinished(true); emit editFinished(true);
} }

View File

@ -31,9 +31,10 @@ void CsvParserModel::setFilename(const QString& filename) {
} }
QString CsvParserModel::getFileInfo(){ QString CsvParserModel::getFileInfo(){
QString a(tr("%n byte(s), ", nullptr, getFileSize())); QString a(tr("%1, %2, %3", "file info: bytes, rows, columns")
a.append(tr("%n row(s), ", nullptr, getCsvRows())); .arg(tr("%n byte(s)", nullptr, getFileSize()))
a.append(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))); .arg(tr("%n row(s)", nullptr, getCsvRows()))
.arg(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
return a; return a;
} }

View File

@ -916,7 +916,7 @@ void EditEntryWidget::insertAttribute()
int i = 1; int i = 1;
while (m_entryAttributes->keys().contains(name)) { while (m_entryAttributes->keys().contains(name)) {
name = QString("%1 %2").arg(tr("New attribute")).arg(i); name = tr("New attribute %1").arg(i);
i++; i++;
} }
@ -979,7 +979,7 @@ void EditEntryWidget::displayAttribute(QModelIndex index, bool showProtected)
if (index.isValid()) { if (index.isValid()) {
QString key = m_attributesModel->keyByIndex(index); QString key = m_attributesModel->keyByIndex(index);
if (showProtected) { 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->attributesEdit->setEnabled(false);
m_advancedUi->revealAttributeButton->setEnabled(true); m_advancedUi->revealAttributeButton->setEnabled(true);
m_advancedUi->protectAttributeButton->setChecked(true); m_advancedUi->protectAttributeButton->setChecked(true);

View File

@ -162,7 +162,7 @@ void EntryAttachmentsWidget::removeSelectedAttachments()
} }
const QString question = tr("Are you sure you want to remove %n attachment(s)?", "", indexes.count()); 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); question, QMessageBox::Yes | QMessageBox::No);
if (answer == QMessageBox::Yes) { if (answer == QMessageBox::Yes) {
QStringList keys; QStringList keys;