gui: Do not translate InitWarning messages in debug.log

This commit is contained in:
Hennadii Stepanov 2020-05-09 14:46:01 +03:00
parent 4c9b9a4882
commit da16f95c3f
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
6 changed files with 12 additions and 13 deletions

View file

@ -971,7 +971,7 @@ bool AppInitParameterInteraction()
// Warn if unrecognized section name are present in the config file. // Warn if unrecognized section name are present in the config file.
for (const auto& section : gArgs.GetUnrecognizedSections()) { for (const auto& section : gArgs.GetUnrecognizedSections()) {
InitWarning(strprintf("%s:%i " + _("Section [%s] is not recognized.").translated, section.m_file, section.m_line, section.m_name)); InitWarning(strprintf(Untranslated("%s:%i ") + _("Section [%s] is not recognized."), section.m_file, section.m_line, section.m_name));
} }
if (!fs::is_directory(GetBlocksDir())) { if (!fs::is_directory(GetBlocksDir())) {
@ -1027,7 +1027,7 @@ bool AppInitParameterInteraction()
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections); nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);
if (nMaxConnections < nUserMaxConnections) if (nMaxConnections < nUserMaxConnections)
InitWarning(strprintf(_("Reducing -maxconnections from %d to %d, because of system limitations.").translated, nUserMaxConnections, nMaxConnections)); InitWarning(strprintf(_("Reducing -maxconnections from %d to %d, because of system limitations."), nUserMaxConnections, nMaxConnections));
// ********************************************************* Step 3: parameter-to-internal-flags // ********************************************************* Step 3: parameter-to-internal-flags
if (gArgs.IsArgSet("-debug")) { if (gArgs.IsArgSet("-debug")) {
@ -1038,7 +1038,7 @@ bool AppInitParameterInteraction()
[](std::string cat){return cat == "0" || cat == "none";})) { [](std::string cat){return cat == "0" || cat == "none";})) {
for (const auto& cat : categories) { for (const auto& cat : categories) {
if (!LogInstance().EnableCategory(cat)) { if (!LogInstance().EnableCategory(cat)) {
InitWarning(strprintf(_("Unsupported logging category %s=%s.").translated, "-debug", cat)); InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat));
} }
} }
} }
@ -1047,7 +1047,7 @@ bool AppInitParameterInteraction()
// Now remove the logging categories which were explicitly excluded // Now remove the logging categories which were explicitly excluded
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) { for (const std::string& cat : gArgs.GetArgs("-debugexclude")) {
if (!LogInstance().DisableCategory(cat)) { if (!LogInstance().DisableCategory(cat)) {
InitWarning(strprintf(_("Unsupported logging category %s=%s.").translated, "-debugexclude", cat)); InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
} }
} }
@ -1260,7 +1260,7 @@ bool AppInitMain(NodeContext& node)
LogPrintf("Config file: %s\n", config_file_path.string()); LogPrintf("Config file: %s\n", config_file_path.string());
} else if (gArgs.IsArgSet("-conf")) { } else if (gArgs.IsArgSet("-conf")) {
// Warn if no conf file exists at path provided by user // Warn if no conf file exists at path provided by user
InitWarning(strprintf(_("The specified config file %s does not exist\n").translated, config_file_path.string())); InitWarning(strprintf(_("The specified config file %s does not exist\n"), config_file_path.string()));
} else { } else {
// Not categorizing as "Warning" because it's the default behavior // Not categorizing as "Warning" because it's the default behavior
LogPrintf("Config file: %s (not found, skipping)\n", config_file_path.string()); LogPrintf("Config file: %s (not found, skipping)\n", config_file_path.string());

View file

@ -344,7 +344,7 @@ public:
bool shutdownRequested() override { return ShutdownRequested(); } bool shutdownRequested() override { return ShutdownRequested(); }
int64_t getAdjustedTime() override { return GetAdjustedTime(); } int64_t getAdjustedTime() override { return GetAdjustedTime(); }
void initMessage(const std::string& message) override { ::uiInterface.InitMessage(message); } void initMessage(const std::string& message) override { ::uiInterface.InitMessage(message); }
void initWarning(const std::string& message) override { InitWarning(message); } void initWarning(const bilingual_str& message) override { InitWarning(message); }
void initError(const bilingual_str& message) override { InitError(message); } void initError(const bilingual_str& message) override { InitError(message); }
void showProgress(const std::string& title, int progress, bool resume_possible) override void showProgress(const std::string& title, int progress, bool resume_possible) override
{ {

View file

@ -225,7 +225,7 @@ public:
virtual void initMessage(const std::string& message) = 0; virtual void initMessage(const std::string& message) = 0;
//! Send init warning. //! Send init warning.
virtual void initWarning(const std::string& message) = 0; virtual void initWarning(const bilingual_str& message) = 0;
//! Send init error. //! Send init error.
virtual void initError(const bilingual_str& message) = 0; virtual void initError(const bilingual_str& message) = 0;

View file

@ -59,7 +59,7 @@ bool InitError(const bilingual_str& str)
return false; return false;
} }
void InitWarning(const std::string& str) void InitWarning(const bilingual_str& str)
{ {
uiInterface.ThreadSafeMessageBox(Untranslated(str), "", CClientUIInterface::MSG_WARNING); uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
} }

View file

@ -120,8 +120,7 @@ public:
}; };
/** Show warning message **/ /** Show warning message **/
// TODO: InitWarning() should take a bilingual_str parameter. void InitWarning(const bilingual_str& str);
void InitWarning(const std::string& str);
/** Show error message **/ /** Show error message **/
bool InitError(const bilingual_str& str); bool InitError(const bilingual_str& str);

View file

@ -56,7 +56,7 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
bilingual_str error_string; bilingual_str error_string;
std::vector<bilingual_str> warnings; std::vector<bilingual_str> warnings;
bool verify_success = CWallet::Verify(chain, location, salvage_wallet, error_string, warnings); bool verify_success = CWallet::Verify(chain, location, salvage_wallet, error_string, warnings);
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated)); if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n")));
if (!verify_success) { if (!verify_success) {
chain.initError(error_string); chain.initError(error_string);
return false; return false;
@ -73,7 +73,7 @@ bool LoadWallets(interfaces::Chain& chain, const std::vector<std::string>& walle
bilingual_str error; bilingual_str error;
std::vector<bilingual_str> warnings; std::vector<bilingual_str> warnings;
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings); std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings);
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated)); if (!warnings.empty()) chain.initWarning(Join(warnings, Untranslated("\n")));
if (!pwallet) { if (!pwallet) {
chain.initError(error); chain.initError(error);
return false; return false;