diff options
| author | Carmina16 <mistresssilvara@hotmail.com> | 2021-03-06 22:32:26 +0700 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-03-06 16:59:32 +0100 |
| commit | 4e89d5d8053697cb882e659a88156eacec15dcfe (patch) | |
| tree | 0228bf64cc1d7fe1baf019769ffc30d4c1c3483e /src/dialogs | |
| parent | cdc3888b5847ee7971fef7fe296f1b483afc000b (diff) | |
| download | kristall-4e89d5d8053697cb882e659a88156eacec15dcfe.tar.gz | |
Implement interface translation
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/certificateiodialog.cpp | 4 | ||||
| -rw-r--r-- | src/dialogs/certificatemanagementdialog.cpp | 38 | ||||
| -rw-r--r-- | src/dialogs/settingsdialog.cpp | 44 |
3 files changed, 44 insertions, 42 deletions
diff --git a/src/dialogs/certificateiodialog.cpp b/src/dialogs/certificateiodialog.cpp index 079d793..75b9775 100644 --- a/src/dialogs/certificateiodialog.cpp +++ b/src/dialogs/certificateiodialog.cpp @@ -65,7 +65,7 @@ void CertificateIoDialog::on_select_certificate_file_button_clicked() { QFileDialog dialog { this }; - dialog.setNameFilter("Certificate File(*.pem *.der)"); + dialog.setNameFilter(tr("Certificate File(*.pem *.der)")); dialog.setAcceptMode((this->current_mode == Export) ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen); dialog.selectFile(this->ui->certificate_file_name->text()); @@ -81,7 +81,7 @@ void CertificateIoDialog::on_select_key_file_button_clicked() { QFileDialog dialog { this }; - dialog.setNameFilter("Certificate File(*.pem *.der)"); + dialog.setNameFilter(tr("Certificate File(*.pem *.der)")); dialog.setAcceptMode((this->current_mode == Export) ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen); dialog.selectFile(this->ui->key_file_name->text()); diff --git a/src/dialogs/certificatemanagementdialog.cpp b/src/dialogs/certificatemanagementdialog.cpp index 9600378..4734b01 100644 --- a/src/dialogs/certificatemanagementdialog.cpp +++ b/src/dialogs/certificatemanagementdialog.cpp @@ -61,7 +61,8 @@ void CertificateManagementDialog::on_certificates_selected(QModelIndex const& in this->ui->cert_display_name->setText(cert.display_name); this->ui->cert_common_name->setText(cert.certificate.subjectInfo(QSslCertificate::CommonName).join(", ")); this->ui->cert_expiration_date->setDateTime(cert.certificate.expiryDate()); - this->ui->cert_livetime->setText(QString("%1 days").arg(QDateTime::currentDateTime().daysTo(cert.certificate.expiryDate()))); + auto days = QDateTime::currentDateTime().daysTo(cert.certificate.expiryDate()); + this->ui->cert_livetime->setText(QString(tr("%1 day","%1 days",days)).arg(days)); this->ui->cert_fingerprint->setPlainText(toFingerprintString(cert.certificate)); this->ui->cert_notes->setPlainText(cert.user_notes); @@ -113,29 +114,29 @@ void CertificateManagementDialog::on_delete_cert_button_clicked() { auto answer = QMessageBox::question( this, - "Kristall", - "Do you really want to delete this certificate?\r\n\r\nYou will not be able to restore the identity after this!", + tr("Kristall"), + tr("Do you really want to delete this certificate?\r\n\r\nYou will not be able to restore the identity after this!"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ); if(answer != QMessageBox::Yes) return; if(not identity_set.destroyIdentity(index)) { - QMessageBox::warning(this, "Kristall", "Could not destroy identity!"); + QMessageBox::warning(this, tr("Kristall"), tr("Could not destroy identity!")); } } else if(auto group_name = identity_set.group(index); not group_name.isEmpty()) { auto answer = QMessageBox::question( this, - "Kristall", - QString("Do you want to delete the group '%1'").arg(group_name) + tr("Kristall"), + QString(tr("Do you want to delete the group '%1'")).arg(group_name) ); if(answer != QMessageBox::Yes) return; if(not identity_set.deleteGroup(group_name)) { - QMessageBox::warning(this, "Kristall", "Could not delete group!"); + QMessageBox::warning(this, tr("Kristall"), tr("Could not delete group!")); } } } @@ -157,7 +158,7 @@ void CertificateManagementDialog::on_export_cert_button_clicked() if(not cert_file.open(QFile::WriteOnly)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The file %1 could not be found!").arg(dialog.certificateFileName()) ); return; @@ -173,7 +174,7 @@ void CertificateManagementDialog::on_export_cert_button_clicked() if(not IoUtil::writeAll(cert_file, cert_blob)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The file %1 could not be created found!").arg(dialog.certificateFileName()) ); return; @@ -185,7 +186,7 @@ void CertificateManagementDialog::on_export_cert_button_clicked() if(not key_file.open(QFile::WriteOnly)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The file %1 could not be found!").arg(dialog.keyFileName()) ); return; @@ -201,8 +202,8 @@ void CertificateManagementDialog::on_export_cert_button_clicked() if(not IoUtil::writeAll(key_file, key_blob)) { QMessageBox::warning( this, - "Kristall", - tr("The file %1 could not be created found!").arg(dialog.keyFileName()) + tr("Kristall"), + tr("The file %1 could not be created!").arg(dialog.keyFileName()) ); return; } @@ -222,7 +223,7 @@ void CertificateManagementDialog::on_import_cert_button_clicked() if(not cert_file.open(QFile::ReadOnly)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The file %1 could not be found!").arg(dialog.certificateFileName()) ); return; @@ -232,7 +233,7 @@ void CertificateManagementDialog::on_import_cert_button_clicked() if(not key_file.open(QFile::ReadOnly)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The file %1 could not be found!").arg(dialog.keyFileName()) ); return; @@ -250,7 +251,8 @@ void CertificateManagementDialog::on_import_cert_button_clicked() dialog.keyFileName().endsWith(".der") ? QSsl::Der : QSsl::Pem, }; ident.user_notes = tr("Imported from:\r\nkey: %1\r\n:cert: %2").arg(dialog.keyFileName(), dialog.certificateFileName()); - ident.display_name = "Imported Certificate"; + //: Default name + ident.display_name = tr("Imported Certificate"); ident.auto_enable = false; ident.host_filter = ""; ident.is_persistent = true; @@ -258,7 +260,7 @@ void CertificateManagementDialog::on_import_cert_button_clicked() if(ident.private_key.isNull()) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The key file %1 could not be loaded. Please verify your key file.").arg(dialog.keyFileName()) ); return; @@ -267,7 +269,7 @@ void CertificateManagementDialog::on_import_cert_button_clicked() if(ident.certificate.isNull()) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("The certificate file %1 could not be loaded. Please verify your certificate.").arg(dialog.keyFileName()) ); return; @@ -276,7 +278,7 @@ void CertificateManagementDialog::on_import_cert_button_clicked() if(not identity_set.addCertificate(tr("Imported Certificates"), ident)) { QMessageBox::warning( this, - "Kristall", + tr("Kristall"), tr("Failed to import the certificate.") ); } diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index b883970..8072b43 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -45,9 +45,9 @@ SettingsDialog::SettingsDialog(QWidget *parent) : this->ui->ui_density->addItem(tr("Classic"), QVariant::fromValue<int>(int(UIDensity::classic))); this->ui->list_symbol->clear(); - this->ui->list_symbol->addItem("Filled circle", QVariant::fromValue<int>(int(QTextListFormat::Style::ListDisc))); - this->ui->list_symbol->addItem("Circle", QVariant::fromValue<int>(int(QTextListFormat::Style::ListCircle))); - this->ui->list_symbol->addItem("Square", QVariant::fromValue<int>(int(QTextListFormat::Style::ListSquare))); + this->ui->list_symbol->addItem(tr("Filled circle"), QVariant::fromValue<int>(int(QTextListFormat::Style::ListDisc))); + this->ui->list_symbol->addItem(tr("Circle"), QVariant::fromValue<int>(int(QTextListFormat::Style::ListCircle))); + this->ui->list_symbol->addItem(tr("Square"), QVariant::fromValue<int>(int(QTextListFormat::Style::ListSquare))); setGeminiStyle(DocumentStyle { }); @@ -80,11 +80,11 @@ SettingsDialog::SettingsDialog(QWidget *parent) : } this->ui->redirection_mode->clear(); - this->ui->redirection_mode->addItem("Ask for cross-scheme or cross-host redirection", int(GenericSettings::WarnOnHostChange | GenericSettings::WarnOnSchemeChange)); - this->ui->redirection_mode->addItem("Ask for cross-scheme redirection", int(GenericSettings::WarnOnSchemeChange)); - this->ui->redirection_mode->addItem("Ask for cross-host redirection", int(GenericSettings::WarnOnHostChange)); - this->ui->redirection_mode->addItem("Ask for all redirection", int(GenericSettings::WarnAlways)); - this->ui->redirection_mode->addItem("Silently redirect everything", int(GenericSettings::WarnNever)); + this->ui->redirection_mode->addItem(tr("Ask for cross-scheme or cross-host redirection"), int(GenericSettings::WarnOnHostChange | GenericSettings::WarnOnSchemeChange)); + this->ui->redirection_mode->addItem(tr("Ask for cross-scheme redirection"), int(GenericSettings::WarnOnSchemeChange)); + this->ui->redirection_mode->addItem(tr("Ask for cross-host redirection"), int(GenericSettings::WarnOnHostChange)); + this->ui->redirection_mode->addItem(tr("Ask for all redirection"), int(GenericSettings::WarnAlways)); + this->ui->redirection_mode->addItem(tr("Silently redirect everything"), int(GenericSettings::WarnNever)); connect(this->ui->tabWidget, &QTabWidget::currentChanged, this, [this] (int index) { if (index != 1) /* Style tab */ @@ -260,7 +260,7 @@ void SettingsDialog::setOptions(const GenericSettings &options) this->ui->search_engine->clear(); QString search = this->current_options.search_engine; - this->ui->search_engine->lineEdit()->setPlaceholderText("URL with '%1' in place of query"); + this->ui->search_engine->lineEdit()->setPlaceholderText(tr("URL with '%1' in place of query")); this->ui->search_engine->addItem("gemini://geminispace.info/search?%1"); this->ui->search_engine->addItem("gemini://gus.guru/search?%1"); this->ui->search_engine->addItem("gemini://houston.coder.town/search?%1"); @@ -317,7 +317,7 @@ void SettingsDialog::setOptions(const GenericSettings &options) this->ui->emojis_on->setEnabled(false); this->ui->emojis_off->setEnabled(false); this->ui->emojis_label->setToolTip( - this->ui->emojis_label->toolTip() + " (not supported in this build)"); + this->ui->emojis_label->toolTip() + tr(" (not supported in this build)")); } } @@ -615,9 +615,9 @@ void SettingsDialog::on_preset_new_clicked() { QInputDialog dlg { this }; dlg.setInputMode(QInputDialog::TextInput); - dlg.setOkButtonText("Save"); - dlg.setCancelButtonText("Cancel"); - dlg.setLabelText("Enter the name of your new preset:"); + dlg.setOkButtonText(tr("Save")); + dlg.setCancelButtonText(tr("Cancel")); + dlg.setLabelText(tr("Enter the name of your new preset:")); if(dlg.exec() != QInputDialog::Accepted) return; @@ -626,7 +626,7 @@ void SettingsDialog::on_preset_new_clicked() bool override = false; if(this->predefined_styles.contains(name)) { - auto response = QMessageBox::question(this, "Kristall", QString("A style with the name '%1' already exists! Replace?").arg(name)); + auto response = QMessageBox::question(this, "Kristall", QString(tr("A style with the name '%1' already exists! Replace?")).arg(name)); if(response != QMessageBox::Yes) return; override = true; @@ -646,7 +646,7 @@ void SettingsDialog::on_preset_save_clicked() if(name.isEmpty()) return; - auto response = QMessageBox::question(this, "Kristall", QString("Do you want to override the style '%1'?").arg(name)); + auto response = QMessageBox::question(this, "Kristall", QString(tr("Do you want to override the style '%1'?")).arg(name)); if(response != QMessageBox::Yes) return; @@ -660,7 +660,7 @@ void SettingsDialog::on_preset_load_clicked() if(name.isEmpty()) return; - auto response = QMessageBox::question(this, "Kristall", QString("Do you want to load the style '%1'?\r\nThis will discard all currently set up values!").arg(name)); + auto response = QMessageBox::question(this, "Kristall", QString(tr("Do you want to load the style '%1'?\r\nThis will discard all currently set up values!")).arg(name)); if(response != QMessageBox::Yes) return; @@ -698,7 +698,7 @@ void SettingsDialog::on_preset_import_clicked() { QFileDialog dialog { this }; dialog.setAcceptMode(QFileDialog::AcceptOpen); - dialog.selectNameFilter("Kristall Theme (*.kthm)"); + dialog.selectNameFilter(tr("Kristall Theme (*.kthm)")); if(dialog.exec() !=QFileDialog::Accepted) return; @@ -715,9 +715,9 @@ void SettingsDialog::on_preset_import_clicked() { QInputDialog dlg { this }; dlg.setInputMode(QInputDialog::TextInput); - dlg.setOkButtonText("Save"); - dlg.setCancelButtonText("Cancel"); - dlg.setLabelText("Imported preset has no name.\r\nPlease enter a name for the preset:"); + dlg.setOkButtonText(tr("Save")); + dlg.setCancelButtonText(tr("Cancel")); + dlg.setLabelText(tr("Imported preset has no name.\r\nPlease enter a name for the preset:")); if(dlg.exec() != QDialog::Accepted) return; name = dlg.textValue(); @@ -726,7 +726,7 @@ void SettingsDialog::on_preset_import_clicked() bool override = false; if(this->predefined_styles.contains(name)) { - auto response = QMessageBox::question(this, "Kristall", QString("Do you want to override the style '%1'?").arg(name)); + auto response = QMessageBox::question(this, "Kristall", QString(tr("Do you want to override the style '%1'?")).arg(name)); if(response != QMessageBox::Yes) return; override = true; @@ -751,7 +751,7 @@ void SettingsDialog::on_preset_export_clicked() QFileDialog dialog { this }; dialog.setAcceptMode(QFileDialog::AcceptSave); - dialog.selectNameFilter("Kristall Theme (*.kthm)"); + dialog.selectNameFilter(tr("Kristall Theme (*.kthm)")); dialog.selectFile(QString("%1.kthm").arg(name)); if(dialog.exec() !=QFileDialog::Accepted) |
