mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Translate PanicAlert captions too.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6841 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -145,6 +145,10 @@ private:
|
||||
#define __chdir chdir
|
||||
#endif
|
||||
|
||||
// Dummy macro for marking translatable strings that can not be immediately translated.
|
||||
// wxWidgets does not have a true dummy macro for this.
|
||||
#define _trans(a) a
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || defined __APPLE__
|
||||
#define _M_SSE 0x301
|
||||
#endif
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -32,34 +32,34 @@ typedef const char * (*StringTranslator)(const char* text);
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler);
|
||||
void RegisterStringTranslator(StringTranslator translator);
|
||||
|
||||
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...)
|
||||
extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 4, 5)))
|
||||
__attribute__((format(printf, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
void SetEnableAlert(bool enable);
|
||||
|
||||
#ifndef GEKKO
|
||||
#ifdef _WIN32
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert("Warning", false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert("Information", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert("Warning", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert("Warning", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert("Question", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
// GEKKO
|
||||
|
Reference in New Issue
Block a user