From 1ae8663decb3163b92d32b80cefb46eb678a5af6 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Thu, 2 Dec 2021 01:25:46 +0800 Subject: Add i18n Support 1. Remove Qt Linguist. 2. Add GNU gettext libraries. 3. Modified source codes to meet with i18n support. --- src/ui/QuitDialog.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/ui/QuitDialog.cpp') diff --git a/src/ui/QuitDialog.cpp b/src/ui/QuitDialog.cpp index f6b3f196..a5ed7c3f 100755 --- a/src/ui/QuitDialog.cpp +++ b/src/ui/QuitDialog.cpp @@ -1,7 +1,7 @@ /** - * This file is part of GPGFrontend. + * This file is part of GpgFrontend. * - * GPGFrontend is free software: you can redistribute it and/or modify + * GpgFrontend is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -24,11 +24,13 @@ #include "ui/QuitDialog.h" +#include + namespace GpgFrontend::UI { QuitDialog::QuitDialog(QWidget* parent, const QHash& unsavedDocs) : QDialog(parent) { - setWindowTitle(tr("Unsaved Files")); + setWindowTitle(_("Unsaved Files")); setModal(true); discarded = false; @@ -75,10 +77,12 @@ QuitDialog::QuitDialog(QWidget* parent, const QHash& unsavedDocs) pixmap = pixmap.scaled(50, 50, Qt::KeepAspectRatio, Qt::SmoothTransformation); auto* warn_icon = new QLabel(); warn_icon->setPixmap(pixmap); - auto* warn_label = - new QLabel(tr("%1 files contain unsaved information.
Save the " - "changes before closing?") - .arg(row)); + + const auto info = + boost::format(_("%1% files contain unsaved information.
Save the " + "changes before closing?")) % + std::to_string(row); + auto* warn_label = new QLabel(QString::fromStdString(info.str())); auto* warnBoxLayout = new QHBoxLayout(); warnBoxLayout->addWidget(warn_icon); warnBoxLayout->addWidget(warn_label); @@ -89,10 +93,10 @@ QuitDialog::QuitDialog(QWidget* parent, const QHash& unsavedDocs) /* * Two labels on top and under the filelist */ - auto* checkLabel = new QLabel(tr("Check the files you want to save:")); - auto* note_label = - new QLabel(tr("Note: If you don't save these files, all changes " - "are lost.
")); + auto* checkLabel = new QLabel(_("Check the files you want to save:")); + auto* note_label = new QLabel( + "" + QString(_("Note")) + ":" + + _("If you don't save these files, all changes are lost.") + "
"); /* * Buttonbox @@ -122,9 +126,7 @@ void QuitDialog::slotMyDiscard() { reject(); } -bool QuitDialog::isDiscarded() const { - return discarded; -} +bool QuitDialog::isDiscarded() const { return discarded; } QList QuitDialog::getTabIdsToSave() { QList tabIdsToSave; -- cgit v1.2.3