From 984b0d14d2f5008440dfdbe4fe3a52c6d5ecf353 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 13 Jan 2011 20:53:37 +0000 Subject: Translate PanicAlert captions too. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6841 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/MsgHandler.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common/Src/MsgHandler.cpp') diff --git a/Source/Core/Common/Src/MsgHandler.cpp b/Source/Core/Common/Src/MsgHandler.cpp index d851ec0b74..231d9c34b4 100644 --- a/Source/Core/Common/Src/MsgHandler.cpp +++ b/Source/Core/Common/Src/MsgHandler.cpp @@ -49,12 +49,37 @@ void SetEnableAlert(bool enable) /* This is the first stop for gui alerts where the log is updated and the correct windows is shown */ -bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...) +bool MsgAlert(bool yes_no, int Style, const char* format, ...) { // Read message and write it to the log + std::string caption; char buffer[2048]; bool ret = true; + static std::string info_caption; + static std::string warn_caption; + static std::string ques_caption; + + if (!info_caption.length()) + { + info_caption = std::string(str_translator(_trans("Information"))); + ques_caption = std::string(str_translator(_trans("Question"))); + warn_caption = std::string(str_translator(_trans("Warning"))); + } + + switch(Style) + { + case INFORMATION: + caption = info_caption; + break; + case QUESTION: + caption = ques_caption; + break; + case WARNING: + caption = warn_caption; + break; + } + const char *tr_format = str_translator(format); va_list args; @@ -62,11 +87,11 @@ bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, . CharArrayFromFormatV(buffer, 2047, tr_format, args); va_end(args); - ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer); + ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer); // Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored if (msg_handler && (AlertEnabled || Style == QUESTION)) { - ret = msg_handler(caption, buffer, yes_no, Style); + ret = msg_handler(caption.c_str(), buffer, yes_no, Style); } return ret; } -- cgit v1.2.3