summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2011-01-13 20:53:37 +0000
committerGlenn Rice <glennricster@gmail.com>2011-01-13 20:53:37 +0000
commit984b0d14d2f5008440dfdbe4fe3a52c6d5ecf353 (patch)
tree6c56d9c6c2eb668711233dc80cab680b37dce091 /Source/Core
parent3a8290a8253ecb3c19b9b91faac620edabca6edb (diff)
Translate PanicAlert captions too.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6841 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/Common.h4
-rw-r--r--Source/Core/Common/Src/MsgHandler.cpp31
-rw-r--r--Source/Core/Common/Src/MsgHandler.h36
-rw-r--r--Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/CheatsWindow.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/Main.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/PatchAddEdit.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/UDPConfigDiag.cpp2
9 files changed, 55 insertions, 28 deletions
diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h
index 8f08d8d4a7..7bbed7590e 100644
--- a/Source/Core/Common/Src/Common.h
+++ b/Source/Core/Common/Src/Common.h
@@ -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
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;
}
diff --git a/Source/Core/Common/Src/MsgHandler.h b/Source/Core/Common/Src/MsgHandler.h
index 42194b3260..4924277374 100644
--- a/Source/Core/Common/Src/MsgHandler.h
+++ b/Source/Core/Common/Src/MsgHandler.h
@@ -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
diff --git a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
index 34120bec43..54fd100f02 100644
--- a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
+++ b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
@@ -65,7 +65,7 @@ void CARCodeAddEdit::CreateGUIControls(int _selection)
EntrySelection->SetValue((int)(arCodes.size() - _selection));
EditCheatCode = new wxTextCtrl(this, ID_EDITCHEAT_CODE, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
UpdateTextCtrl(tempEntries);
- wxButton* bOK = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
diff --git a/Source/Core/DolphinWX/Src/CheatsWindow.cpp b/Source/Core/DolphinWX/Src/CheatsWindow.cpp
index 13fd3c72ed..fd4c6c9e3d 100644
--- a/Source/Core/DolphinWX/Src/CheatsWindow.cpp
+++ b/Source/Core/DolphinWX/Src/CheatsWindow.cpp
@@ -564,7 +564,7 @@ CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address)
sizer_value_label->Add(label_value, 0, wxRIGHT, 5);
sizer_value_label->Add(checkbox_use_hex, 0, 0, 0);
- wxButton* const btn_ok = new wxButton(panel, -1, wxT("OK"));
+ wxButton* const btn_ok = new wxButton(panel, -1, _("OK"));
_connect_macro_(btn_ok, CreateCodeDialog::PressOK, wxEVT_COMMAND_BUTTON_CLICKED, this);
wxButton* const btn_cancel = new wxButton(panel, -1, _("Cancel"));
_connect_macro_(btn_cancel, CreateCodeDialog::PressCancel, wxEVT_COMMAND_BUTTON_CLICKED, this);
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 5d217467ff..3bc1aa6d91 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -62,8 +62,6 @@ static const wxLanguage langIds[] =
wxLANGUAGE_SPANISH,
};
-#define _trans(a) a
-
// Strings for Device Selections
#define DEV_NONE_STR _trans("<Nothing>")
#define DEV_DUMMY_STR _trans("Dummy")
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp
index 252fd160fe..7a54d2510c 100644
--- a/Source/Core/DolphinWX/Src/Main.cpp
+++ b/Source/Core/DolphinWX/Src/Main.cpp
@@ -456,7 +456,7 @@ bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*
if (wxIsMainThread())
#endif
return wxYES == wxMessageBox(wxString::FromUTF8(text),
- wxString::FromAscii(caption),
+ wxString::FromUTF8(caption),
(yes_no) ? wxYES_NO : wxOK, main_frame);
#ifdef __WXGTK__
else
diff --git a/Source/Core/DolphinWX/Src/PatchAddEdit.cpp b/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
index c3e8f73150..aa7216433e 100644
--- a/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
+++ b/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
@@ -99,7 +99,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
sbEntry->Add(sEntryAddRemove, 0, wxEXPAND);
sEditPatch->Add(sbEntry, 0, wxEXPAND|wxALL, 5);
wxBoxSizer* sEditPatchButtons = new wxBoxSizer(wxHORIZONTAL);
- wxButton* bOK = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
sEditPatchButtons->Add(0, 0, 1, wxEXPAND, 5);
sEditPatchButtons->Add(bOK, 0, wxALL, 5);
diff --git a/Source/Core/DolphinWX/Src/UDPConfigDiag.cpp b/Source/Core/DolphinWX/Src/UDPConfigDiag.cpp
index e21e3502fe..8bc8686213 100644
--- a/Source/Core/DolphinWX/Src/UDPConfigDiag.cpp
+++ b/Source/Core/DolphinWX/Src/UDPConfigDiag.cpp
@@ -26,7 +26,7 @@ UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
nun = new wxCheckBox(this,wxID_ANY,_("Nunchuk"));
nunaccel = new wxCheckBox(this,wxID_ANY,_("Nunchuk Acceleration"));
- wxButton *const ok_butt = new wxButton(this,wxID_ANY,wxT("OK"));
+ wxButton *const ok_butt = new wxButton(this,wxID_ANY,_("OK"));
wxBoxSizer *const port_sizer = new wxBoxSizer(wxHORIZONTAL);
port_sizer->Add(new wxStaticText(this, wxID_ANY, _("UDP Port:")), 0, wxALIGN_CENTER);