Make ThreadSafe{MessageBox|Question} bilingual

This commit is contained in:
Hennadii Stepanov
2020-04-11 18:47:17 +03:00
parent 23b9fa2e5e
commit 917ca93553
14 changed files with 82 additions and 64 deletions

View File

@@ -5,8 +5,9 @@
#include <noui.h>
#include <logging.h>
#include <ui_interface.h>
#include <util/system.h>
#include <util/translation.h>
#include <string>
@@ -18,7 +19,7 @@ boost::signals2::connection noui_ThreadSafeMessageBoxConn;
boost::signals2::connection noui_ThreadSafeQuestionConn;
boost::signals2::connection noui_InitMessageConn;
bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style)
{
bool fSecure = style & CClientUIInterface::SECURE;
style &= ~CClientUIInterface::SECURE;
@@ -43,15 +44,15 @@ bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& ca
}
if (!fSecure) {
LogPrintf("%s%s\n", strCaption, message);
LogPrintf("%s%s\n", strCaption, message.original);
}
tfm::format(std::cerr, "%s%s\n", strCaption, message);
tfm::format(std::cerr, "%s%s\n", strCaption, message.original);
return false;
}
bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
{
return noui_ThreadSafeMessageBox(message, caption, style);
return noui_ThreadSafeMessageBox(Untranslated(message), caption, style);
}
void noui_InitMessage(const std::string& message)
@@ -66,13 +67,13 @@ void noui_connect()
noui_InitMessageConn = uiInterface.InitMessage_connect(noui_InitMessage);
}
bool noui_ThreadSafeMessageBoxRedirect(const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message);
LogPrintf("%s: %s\n", caption, message.original);
return false;
}
bool noui_ThreadSafeQuestionRedirect(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
bool noui_ThreadSafeQuestionRedirect(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message);
return false;