From 18c59b62633e9cb12a4f2c8200afa9a69a4d12a1 Mon Sep 17 00:00:00 2001 From: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:39:32 -0500 Subject: [PATCH] Merge #16291: gui: Stop translating PACKAGE_NAME (#4723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Merge #16291: gui: Stop translating PACKAGE_NAME fa64b947bb3075ff8737656706b941af691908ab util: No translation of `Bitcoin Core` in the copyright (MarcoFalke) fab85208f678ba1be53bdb73a73ce3c5c937d448 qt: Run «make translate» in ./src/ (MarcoFalke) fabe87d2c923ab3a70b8cde2666a4d1cda8b22fb scripted-diff: Avoid passing PACKAGE_NAME for translation (MarcoFalke) fa5e9f157e568b7fbbea1482b393181f0733f2ba build: Stop translating PACKAGE_NAME (MarcoFalke) Pull request description: Generally the package name is not translated, but the package description is. E.g. `GIMP` or `Firefox` are always called that way regardless of the system language. However, "`Firefox` webbrowser" or "`GIMP` image manipulation program" are translated. ACKs for top commit: hebasto: ACK fa64b947bb3075ff8737656706b941af691908ab, I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged. Tree-SHA512: 626f811531182d0ba0ef1044930d32726773349bcb49b10261288a86ee6b80a183db30a87d817d5b0d501fad058ac22d6272311716b4f5a154f17c6f391a5a1a * more Co-authored-by: MarcoFalke Co-authored-by: UdjinM6 --- share/qt/extract_strings_qt.py | 3 --- src/Makefile.qt.include | 2 +- src/init.cpp | 4 ++-- src/net.cpp | 2 +- src/qt/bitcoingui.cpp | 12 ++++++------ src/qt/dash.cpp | 28 ++++++++++++++-------------- src/qt/guiutil.cpp | 2 +- src/qt/intro.cpp | 12 ++++++------ src/qt/optionsdialog.cpp | 6 +++--- src/qt/rpcconsole.cpp | 4 ++-- src/qt/splashscreen.cpp | 2 +- src/qt/utilitydialog.cpp | 6 +++--- src/timedata.cpp | 2 +- src/util/system.cpp | 8 +++++--- src/wallet/wallet.cpp | 4 ++-- test/lint/lint-format-strings.py | 3 +-- 16 files changed, 49 insertions(+), 51 deletions(-) diff --git a/share/qt/extract_strings_qt.py b/share/qt/extract_strings_qt.py index 45efbaaedd..a6772dff7a 100755 --- a/share/qt/extract_strings_qt.py +++ b/share/qt/extract_strings_qt.py @@ -76,10 +76,7 @@ f.write(""" #endif """) f.write('static const char UNUSED *dash_strings[] = {\n') -f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('PACKAGE_NAME'),)) f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS'),)) -if os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION') != os.getenv('PACKAGE_NAME'): - f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION'),)) messages.sort(key=operator.itemgetter(0)) for (msgid, msgstr) in messages: if msgid != EMPTY: diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index de08c77b76..ff39e7ea6b 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -427,7 +427,7 @@ SECONDARY: $(QT_QM) $(srcdir)/qt/dashstrings.cpp: FORCE @test -n $(XGETTEXT) || echo "xgettext is required for updating translations" - $(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $(libdash_server_a_SOURCES) $(libdash_wallet_a_SOURCES) $(libdash_common_a_SOURCES) $(libdash_zmq_a_SOURCES) $(libdash_consensus_a_SOURCES) $(libdash_util_a_SOURCES) + $(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" $(PYTHON) ../share/qt/extract_strings_qt.py $(libdash_server_a_SOURCES) $(libdash_wallet_a_SOURCES) $(libdash_common_a_SOURCES) $(libdash_zmq_a_SOURCES) $(libdash_consensus_a_SOURCES) $(libdash_util_a_SOURCES) translate: $(srcdir)/qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/dash.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM) @test -n $(LUPDATE) || echo "lupdate is required for updating translations" diff --git a/src/init.cpp b/src/init.cpp index 8a9f4577b5..58f99ac769 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1576,7 +1576,7 @@ static bool LockDataDirectory(bool probeOnly) return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string())); } if (!LockDirectory(datadir, ".lock", probeOnly)) { - return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), _(PACKAGE_NAME))); + return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), PACKAGE_NAME)); } return true; } @@ -1594,7 +1594,7 @@ bool AppInitSanityChecks() // Sanity check if (!InitSanityCheck()) - return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down."), _(PACKAGE_NAME))); + return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down."), PACKAGE_NAME)); // Probe the data directory lock to give an early error message, if possible // We cannot hold the data directory lock here, as the forking for daemon() hasn't yet happened, diff --git a/src/net.cpp b/src/net.cpp index 6ddf6ce1f3..a4923ed40a 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2656,7 +2656,7 @@ bool CConnman::BindListenPort(const CService& addrBind, std::string& strError, N { int nErr = WSAGetLastError(); if (nErr == WSAEADDRINUSE) - strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), _(PACKAGE_NAME)); + strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), PACKAGE_NAME); else strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr)); LogPrintf("%s\n", strError); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index fba897e92b..b8c7089651 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -368,15 +368,15 @@ void BitcoinGUI::createActions() quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); - aboutAction = new QAction(tr("&About %1").arg(tr(PACKAGE_NAME)), this); - aboutAction->setStatusTip(tr("Show information about Dash Core")); + aboutAction = new QAction(tr("&About %1").arg(PACKAGE_NAME), this); + aboutAction->setStatusTip(tr("Show information about %1").arg(PACKAGE_NAME)); aboutAction->setMenuRole(QAction::AboutRole); aboutAction->setEnabled(false); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(tr("&Options..."), this); - optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME))); + optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(PACKAGE_NAME)); optionsAction->setMenuRole(QAction::PreferencesRole); optionsAction->setEnabled(false); toggleHideAction = new QAction(tr("&Show / Hide"), this); @@ -438,7 +438,7 @@ void BitcoinGUI::createActions() showHelpMessageAction = new QAction(tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); - showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Dash command-line options").arg(tr(PACKAGE_NAME))); + showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Dash command-line options").arg(PACKAGE_NAME)); showCoinJoinHelpAction = new QAction(tr("%1 &information").arg(strCoinJoinName), this); showCoinJoinHelpAction->setMenuRole(QAction::NoRole); @@ -974,7 +974,7 @@ void BitcoinGUI::createTrayIcon() if (QSystemTrayIcon::isSystemTrayAvailable()) { trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this); - QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText(); + QString toolTip = tr("%1 client").arg(PACKAGE_NAME) + " " + m_network_style->getTitleAddText(); trayIcon->setToolTip(toolTip); } } @@ -1857,7 +1857,7 @@ void BitcoinGUI::updateProxyIcon() void BitcoinGUI::updateWindowTitle() { - QString window_title = tr(PACKAGE_NAME); + QString window_title = PACKAGE_NAME; #ifdef ENABLE_WALLET if (walletFrame) { WalletModel* const wallet_model = walletFrame->currentWalletModel(); diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index dabe7b961c..ed01a3a1e4 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -480,7 +480,7 @@ int GuiMain(int argc, char* argv[]) SetupUIArgs(); std::string error; if (!node->parseParameters(argc, argv, error)) { - QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error parsing command line arguments: %1.").arg(QString::fromStdString(error))); return EXIT_FAILURE; } @@ -500,7 +500,7 @@ int GuiMain(int argc, char* argv[]) if (gArgs.IsArgSet("-printcrashinfo")) { auto crashInfo = GetCrashInfoStrFromSerializedStr(gArgs.GetArg("-printcrashinfo", "")); std::cout << crashInfo << std::endl; - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QString::fromStdString(crashInfo)); + QMessageBox::critical(0, PACKAGE_NAME, QString::fromStdString(crashInfo)); return EXIT_SUCCESS; } @@ -524,12 +524,12 @@ int GuiMain(int argc, char* argv[]) /// - Do not call GetDataDir(true) before this step finishes if (!fs::is_directory(GetDataDir(false))) { - QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); return EXIT_FAILURE; } if (!node->readConfigFiles(error)) { - QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error))); return EXIT_FAILURE; } @@ -544,7 +544,7 @@ int GuiMain(int argc, char* argv[]) try { node->selectParams(gArgs.GetChainName()); } catch(std::exception &e) { - QMessageBox::critical(nullptr, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what())); + QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what())); return EXIT_FAILURE; } #ifdef ENABLE_WALLET @@ -589,7 +589,7 @@ int GuiMain(int argc, char* argv[]) app.parameterSetup(); // Load custom application fonts and setup font management if (!GUIUtil::loadFonts()) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Failed to load application fonts.")); return EXIT_FAILURE; } @@ -602,7 +602,7 @@ int GuiMain(int argc, char* argv[]) try { family = GUIUtil::fontFamilyFromString(strFamily); } catch (const std::exception& e) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Specified font-family invalid. Valid values: %1.").arg("SystemDefault, Montserrat")); return EXIT_FAILURE; } @@ -612,7 +612,7 @@ int GuiMain(int argc, char* argv[]) if (gArgs.IsArgSet("-font-weight-normal")) { QFont::Weight weight; if (!GUIUtil::weightFromArg(gArgs.GetArg("-font-weight-normal", GUIUtil::weightToArg(GUIUtil::getFontWeightNormal())), weight)) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Specified font-weight-normal invalid. Valid range %1 to %2.").arg(0).arg(8)); return EXIT_FAILURE; } @@ -622,7 +622,7 @@ int GuiMain(int argc, char* argv[]) if (gArgs.IsArgSet("-font-weight-bold")) { QFont::Weight weight; if (!GUIUtil::weightFromArg(gArgs.GetArg("-font-weight-bold", GUIUtil::weightToArg(GUIUtil::getFontWeightBold())), weight)) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Specified font-weight-bold invalid. Valid range %1 to %2.").arg(0).arg(8)); return EXIT_FAILURE; } @@ -633,7 +633,7 @@ int GuiMain(int argc, char* argv[]) const int nScaleMin = -100, nScaleMax = 100; int nScale = gArgs.GetArg("-font-scale", GUIUtil::getFontScale()); if (nScale < nScaleMin || nScale > nScaleMax) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Specified font-scale invalid. Valid range %1 to %2.").arg(nScaleMin).arg(nScaleMax)); return EXIT_FAILURE; } @@ -647,7 +647,7 @@ int GuiMain(int argc, char* argv[]) QString strFile; if (!fs::is_directory(customDir)) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: Invalid -custom-css-dir path.") + "\n\n" + strCustomDir); return EXIT_FAILURE; } @@ -667,7 +667,7 @@ int GuiMain(int argc, char* argv[]) for (const auto& strMissingFile : vecRequiredFiles) { strMissingFiles += strMissingFile + "\n"; } - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QMessageBox::critical(0, PACKAGE_NAME, QObject::tr("Error: %1 CSS file(s) missing in -custom-css-dir path.").arg(vecRequiredFiles.size()) + "\n\n" + strMissingFiles); return EXIT_FAILURE; } @@ -676,7 +676,7 @@ int GuiMain(int argc, char* argv[]) } // Validate -debug-ui if (gArgs.GetBoolArg("-debug-ui", false)) { - QMessageBox::warning(0, QObject::tr(PACKAGE_NAME), + QMessageBox::warning(0, PACKAGE_NAME, "Warning: UI debug mode (-debug-ui) enabled" + QString(gArgs.IsArgSet("-custom-css-dir") ? "." : " without a custom css directory set with -custom-css-dir.")); } @@ -693,7 +693,7 @@ int GuiMain(int argc, char* argv[]) if (app.baseInitialize()) { app.requestInitialize(); #if defined(Q_OS_WIN) - WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId()); + WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(PACKAGE_NAME), (HWND)app.getMainWinId()); #endif app.exec(); app.requestShutdown(); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 6e6916b7b0..d93e6ca537 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -284,7 +284,7 @@ void setupAppearance(QWidget* parent, OptionsModel* model) dlg.setWindowTitle(QObject::tr("Appearance Setup")); dlg.setWindowIcon(QIcon(":icons/dash")); // And the widgets we add to it - QLabel lblHeading(QObject::tr("Please choose your preferred settings for the appearance of %1").arg(QObject::tr(PACKAGE_NAME)), &dlg); + QLabel lblHeading(QObject::tr("Please choose your preferred settings for the appearance of %1").arg(PACKAGE_NAME), &dlg); lblHeading.setObjectName("lblHeading"); lblHeading.setWordWrap(true); QLabel lblSubHeading(QObject::tr("This can also be adjusted later in the \"Appearance\" tab of the preferences."), &dlg); diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 184da14791..dbfcddd9c8 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -120,16 +120,16 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz m_chain_state_size(chain_state_size) { ui->setupUi(this); - ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME))); - ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME))); + ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(PACKAGE_NAME)); + ui->storageLabel->setText(ui->storageLabel->text().arg(PACKAGE_NAME)); ui->lblExplanation1->setText(ui->lblExplanation1->text() - .arg(tr(PACKAGE_NAME)) + .arg(PACKAGE_NAME) .arg(m_blockchain_size) .arg(2014) .arg("Dash") ); - ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(tr(PACKAGE_NAME))); + ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(PACKAGE_NAME)); uint64_t pruneTarget = std::max(0, gArgs.GetArg("-prune", 0)); requiredSpace = m_blockchain_size; @@ -146,7 +146,7 @@ Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_siz } requiredSpace += m_chain_state_size; ui->sizeWarningLabel->setText( - tr("%1 will download and store a copy of the Dash block chain.").arg(tr(PACKAGE_NAME)) + " " + + tr("%1 will download and store a copy of the Dash block chain.").arg(PACKAGE_NAME) + " " + storageRequiresMsg.arg(requiredSpace) + " " + tr("The wallet will also be stored in this directory.") ); @@ -227,7 +227,7 @@ bool Intro::pickDataDirectory(interfaces::Node& node) } break; } catch (const fs::filesystem_error&) { - QMessageBox::critical(nullptr, tr(PACKAGE_NAME), + QMessageBox::critical(nullptr, PACKAGE_NAME, tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir)); /* fall through, back to choosing screen */ } diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 84f9906dfd..0eed464cf6 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -137,10 +137,10 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : /* Language selector */ QDir translations(":translations"); - ui->bitcoinAtStartup->setToolTip(ui->bitcoinAtStartup->toolTip().arg(tr(PACKAGE_NAME))); - ui->bitcoinAtStartup->setText(ui->bitcoinAtStartup->text().arg(tr(PACKAGE_NAME))); + ui->bitcoinAtStartup->setToolTip(ui->bitcoinAtStartup->toolTip().arg(PACKAGE_NAME)); + ui->bitcoinAtStartup->setText(ui->bitcoinAtStartup->text().arg(PACKAGE_NAME)); - ui->lang->setToolTip(ui->lang->toolTip().arg(tr(PACKAGE_NAME))); + ui->lang->setToolTip(ui->lang->toolTip().arg(PACKAGE_NAME)); ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant("")); for (const QString &langStr : translations.entryList()) { diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 48dead5862..f8528d97df 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -471,7 +471,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags QChar nonbreaking_hyphen(8209); ui->dataDir->setToolTip(ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) + "datadir")); ui->blocksDir->setToolTip(ui->blocksDir->toolTip().arg(QString(nonbreaking_hyphen) + "blocksdir")); - ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME))); + ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(PACKAGE_NAME)); setButtonIcons(); @@ -898,7 +898,7 @@ void RPCConsole::clear(bool clearHistory) QString clsKey = "Ctrl-L"; #endif - message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(tr(PACKAGE_NAME)) + "
" + + message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(PACKAGE_NAME) + "
" + tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg(""+clsKey+"") + "
" + tr("Type %1 for an overview of available commands.").arg("help") + "
" + tr("For more information on using this console type %1.").arg("help-console") + diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 7e0c50db49..eeef5c1f10 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -51,7 +51,7 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw float scale = qApp->devicePixelRatio(); // define text to place - QString titleText = tr(PACKAGE_NAME); + QString titleText = PACKAGE_NAME; QString versionText = QString::fromStdString(FormatFullVersion()).remove(0, 1); QString titleAddText = networkStyle->getTitleAddText(); diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 40efe0dbf7..a5928612d2 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -40,7 +40,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, He GUIUtil::updateFonts(); - QString version = tr(PACKAGE_NAME) + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()); + QString version = QString{PACKAGE_NAME} + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()); /* On x86 add a bit specifier to the version so that users can distinguish between * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambiguous. */ @@ -52,7 +52,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, He if (helpMode == about) { - setWindowTitle(tr("About %1").arg(tr(PACKAGE_NAME))); + setWindowTitle(tr("About %1").arg(PACKAGE_NAME)); std::string licenseInfo = LicenseInfo(); /// HTML-format the license message from the core @@ -195,7 +195,7 @@ ShutdownWindow::ShutdownWindow(interfaces::Node& node, QWidget *parent, Qt::Wind QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(new QLabel( - tr("%1 is shutting down...").arg(tr(PACKAGE_NAME)) + "

" + + tr("%1 is shutting down...").arg(PACKAGE_NAME) + "

" + tr("Do not shut down the computer until this window disappears."))); setLayout(layout); diff --git a/src/timedata.cpp b/src/timedata.cpp index 88be0d39af..03d1148daa 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -100,7 +100,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) if (!fMatch) { fDone = true; - std::string strMessage = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong, %s will not work properly."), _(PACKAGE_NAME)); + std::string strMessage = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong, %s will not work properly."), PACKAGE_NAME); SetMiscWarning(strMessage); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING); } diff --git a/src/util/system.cpp b/src/util/system.cpp index 8f57502ef4..924ec1c7d4 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1304,14 +1304,16 @@ int GetNumCores() std::string CopyrightHolders(const std::string& strPrefix, unsigned int nStartYear, unsigned int nEndYear) { - std::string strCopyrightHolders = strPrefix + strprintf(" %u-%u ", nStartYear, nEndYear) + strprintf(_(COPYRIGHT_HOLDERS), _(COPYRIGHT_HOLDERS_SUBSTITUTION)); +// std::string strCopyrightHolders = strPrefix + strprintf(" %u-%u ", nStartYear, nEndYear) + strprintf(_(COPYRIGHT_HOLDERS), _(COPYRIGHT_HOLDERS_SUBSTITUTION)); + const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION); + std::string strCopyrightHolders = strPrefix + strprintf(" %u-%u ", nStartYear, nEndYear) + copyright_devs; // Check for untranslated substitution to make sure Dash Core copyright is not removed by accident - if (strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION).find("Dash Core") == std::string::npos) { + if (copyright_devs.find("Dash Core") == std::string::npos) { strCopyrightHolders += "\n" + strPrefix + strprintf(" %u-%u ", 2014, nEndYear) + "The Dash Core developers"; } // Check for untranslated substitution to make sure Bitcoin Core copyright is not removed by accident - if (strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION).find("Bitcoin Core") == std::string::npos) { + if (copyright_devs.find("Bitcoin Core") == std::string::npos) { strCopyrightHolders += "\n" + strPrefix + strprintf(" %u-%u ", 2009, nEndYear) + "The Bitcoin Core developers"; } return strCopyrightHolders; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d7a5a08107..915cf7bf38 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5036,11 +5036,11 @@ std::shared_ptr CWallet::CreateWalletFromFile(interfaces::Chain& chain, walletFile)); } else if (nLoadWalletRet == DBErrors::TOO_NEW) { - return error(strprintf(_("Error loading %s: Wallet requires newer version of %s"), walletFile, _(PACKAGE_NAME))); + return error(strprintf(_("Error loading %s: Wallet requires newer version of %s"), walletFile, PACKAGE_NAME)); } else if (nLoadWalletRet == DBErrors::NEED_REWRITE) { - return error(strprintf(_("Wallet needed to be rewritten: restart %s to complete"), _(PACKAGE_NAME))); + return error(strprintf(_("Wallet needed to be rewritten: restart %s to complete"), PACKAGE_NAME)); } else { return error(strprintf(_("Error loading %s"), walletFile)); diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py index f00754581e..2e5eb3c81a 100755 --- a/test/lint/lint-format-strings.py +++ b/test/lint/lint-format-strings.py @@ -24,8 +24,7 @@ FALSE_POSITIVES = [ ("src/stacktraces.cpp", "strprintf(fmtStr, i, si.pc, lstr, fstr)"), ("src/statsd_client.cpp", "snprintf(d->errmsg, sizeof(d->errmsg), \"could not create socket, err=%m\")"), ("src/statsd_client.cpp", "snprintf(d->errmsg, sizeof(d->errmsg), \"sendto server fail, host=%s:%d, err=%m\", d->host.c_str(), d->port)"), - ("src/util/system.cpp", "strprintf(_(COPYRIGHT_HOLDERS), _(COPYRIGHT_HOLDERS_SUBSTITUTION))"), - ("src/util/system.cpp", "strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION)"), + ("src/util/system.cpp", "strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION)"), ("src/wallet/wallet.h", "WalletLogPrintf(std::string fmt, Params... parameters)"), ("src/wallet/wallet.h", "LogPrintf((\"%s \" + fmt).c_str(), GetDisplayName(), parameters...)"), ("src/logging.h", "LogPrintf(const char* fmt, const Args&... args)"),