From 74ea765427ad499dd16667d8939cb67d83dcdf04 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 20 Nov 2015 11:33:47 +0100 Subject: [PATCH] Mark more strings for translation --- Languages/gettextize | 8 ++--- Source/Core/Common/Assert.h | 4 ++- Source/Core/Common/MsgHandler.cpp | 5 +++ Source/Core/Common/MsgHandler.h | 5 +++ Source/Core/Core/HW/GCPadEmu.cpp | 2 +- Source/Core/Core/State.cpp | 5 +-- Source/Core/DiscIO/CompressedBlob.cpp | 9 +++--- .../DolphinWX/Config/GameCubeConfigPane.cpp | 10 +++--- .../Debugger/CodeWindowFunctions.cpp | 32 +++++++++---------- Source/Core/DolphinWX/FrameTools.cpp | 6 ++-- Source/Core/DolphinWX/GameListCtrl.cpp | 4 +-- Source/Core/VideoCommon/OpcodeDecoding.cpp | 6 ++-- 12 files changed, 54 insertions(+), 42 deletions(-) diff --git a/Languages/gettextize b/Languages/gettextize index dc54fff21b..fc6b3b0350 100755 --- a/Languages/gettextize +++ b/Languages/gettextize @@ -4,10 +4,10 @@ cd ${0/gettextize/}/.. SRCDIR=Source CPP_FILE_LIST=$(find $SRCDIR \( -name '*.cpp' -o -name '*.h' -o -name '*.c' \) \ -a ! -path '*Debug*') -xgettext -d dolphin-emu -s --keyword=_ --keyword=wxTRANSLATE --keyword=SuccessAlertT \ - --keyword=PanicAlertT --keyword=PanicYesNoT --keyword=AskYesNoT --keyword=_trans \ - --keyword=CriticalAlertT --add-comments=i18n -p ./Languages/po -o dolphin-emu.pot \ - $CPP_FILE_LIST --package-name="Dolphin Emulator" +xgettext -d dolphin-emu -s --keyword=_ --keyword=wxTRANSLATE --keyword=SuccessAlertT \ + --keyword=PanicAlertT --keyword=PanicYesNoT --keyword=AskYesNoT --keyword=CriticalAlertT \ + --keyword=GetStringT --keyword=_trans --add-comments=i18n -p ./Languages/po \ + -o dolphin-emu.pot $CPP_FILE_LIST --package-name="Dolphin Emulator" sed -i "s/SOME DESCRIPTIVE TITLE\./Translation of dolphin-emu.pot to LANGUAGE/" Languages/po/dolphin-emu.pot sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2003-2013/" Languages/po/dolphin-emu.pot diff --git a/Source/Core/Common/Assert.h b/Source/Core/Common/Assert.h index 0b359433ff..5114808e7e 100644 --- a/Source/Core/Common/Assert.h +++ b/Source/Core/Common/Assert.h @@ -4,6 +4,7 @@ #pragma once +#include "Common/Common.h" #include "Common/CommonFuncs.h" #include "Common/MsgHandler.h" #include "Common/Logging/Log.h" @@ -37,7 +38,8 @@ #endif #define _assert_(_a_) \ - _assert_msg_(MASTER_LOG, _a_, "Error...\n\n Line: %d\n File: %s\n\nIgnore and continue?", \ + _assert_msg_(MASTER_LOG, _a_, \ + _trans("An error occurred.\n\n Line: %d\n File: %s\n\nIgnore and continue?"), \ __LINE__, __FILE__) #define _dbg_assert_(_t_, _a_) \ diff --git a/Source/Core/Common/MsgHandler.cpp b/Source/Core/Common/MsgHandler.cpp index 075196ced2..e73efe9020 100644 --- a/Source/Core/Common/MsgHandler.cpp +++ b/Source/Core/Common/MsgHandler.cpp @@ -38,6 +38,11 @@ void SetEnableAlert(bool enable) AlertEnabled = enable; } +std::string GetTranslation(const char* string) +{ + return str_translator(string); +} + // This is the first stop for gui alerts where the log is updated and the // correct window is shown bool MsgAlert(bool yes_no, int Style, const char* format, ...) diff --git a/Source/Core/Common/MsgHandler.h b/Source/Core/Common/MsgHandler.h index bf080c5a81..f289486c02 100644 --- a/Source/Core/Common/MsgHandler.h +++ b/Source/Core/Common/MsgHandler.h @@ -22,6 +22,7 @@ typedef std::string (*StringTranslator)(const char* text); void RegisterMsgAlertHandler(MsgAlertHandler handler); void RegisterStringTranslator(StringTranslator translator); +std::string GetTranslation(const char* string); bool MsgAlert(bool yes_no, int Style, const char* format, ...) #ifdef __GNUC__ __attribute__((format(printf, 3, 4))) @@ -41,6 +42,8 @@ void SetEnableAlert(bool enable); #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__) #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__) + + #define GetStringT(string) GetTranslation(string) #else #define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__) #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__) @@ -53,4 +56,6 @@ void SetEnableAlert(bool enable); #define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__) #define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__) #define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__) + + #define GetStringT(string) GetTranslation(string) #endif diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index 8069e8f06c..66f90594a7 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -36,7 +36,7 @@ static const char* const named_buttons[] = "Y", "Z", _trans("Start"), - "Mic" + _trans("Mic") }; static const char* const named_triggers[] = diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index c14c9dc9ef..d7877dfb11 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -9,6 +9,7 @@ #include "Common/CommonTypes.h" #include "Common/Event.h" +#include "Common/MsgHandler.h" #include "Common/ScopeGuard.h" #include "Common/StringUtil.h" #include "Common/Thread.h" @@ -452,11 +453,11 @@ std::string GetInfoStringOfSlot(int slot) { std::string filename = MakeStateFilename(slot); if (!File::Exists(filename)) - return "Empty"; + return GetStringT("Empty"); State::StateHeader header; if (!ReadHeader(filename, header)) - return "Unknown"; + return GetStringT("Unknown"); return Common::Timer::GetDateTimeFormatted(header.time); } diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index 7b01aeed5d..b963f54d7c 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -190,7 +190,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u return false; } - callback("Files opened, ready to compress.", 0, arg); + callback(GetStringT("Files opened, ready to compress."), 0, arg); CompressedBlobHeader header; header.magic_cookie = kBlobCookie; @@ -227,7 +227,8 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u if (inpos != 0) ratio = (int)(100 * position / inpos); - std::string temp = StringFromFormat("%i of %i blocks. Compression ratio %i%%", i, header.num_blocks, ratio); + std::string temp = StringFromFormat(GetStringT("%i of %i blocks. Compression ratio %i%%").c_str(), + i, header.num_blocks, ratio); bool was_cancelled = !callback(temp, (float)i / (float)header.num_blocks, arg); if (was_cancelled) { @@ -325,7 +326,7 @@ bool CompressFileToBlob(const std::string& infile, const std::string& outfile, u if (success) { - callback("Done compressing disc image.", 1.0f, arg); + callback(GetStringT("Done compressing disc image."), 1.0f, arg); } return success; } @@ -368,7 +369,7 @@ bool DecompressBlobToFile(const std::string& infile, const std::string& outfile, { if (i % progress_monitor == 0) { - bool was_cancelled = !callback("Unpacking", (float)i / (float)num_buffers, arg); + bool was_cancelled = !callback(GetStringT("Unpacking"), (float)i / (float)num_buffers, arg); if (was_cancelled) { success = false; diff --git a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp index 721a1eecc3..db6a22751f 100644 --- a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp @@ -30,11 +30,11 @@ #define EXIDEV_MEMCARD_STR _trans("Memory Card") #define EXIDEV_MEMDIR_STR _trans("GCI Folder") -#define EXIDEV_MIC_STR _trans("Mic") -#define EXIDEV_BBA_STR "BBA" -#define EXIDEV_AGP_STR "Advance Game Port" -#define EXIDEV_AM_BB_STR _trans("AM-Baseboard") -#define EXIDEV_GECKO_STR "USBGecko" +#define EXIDEV_MIC_STR _trans("Microphone") +#define EXIDEV_BBA_STR _trans("Broadband Adapter") +#define EXIDEV_AGP_STR _trans("Advance Game Port") +#define EXIDEV_AM_BB_STR _trans("AM Baseboard") +#define EXIDEV_GECKO_STR _trans("USB Gecko") GameCubeConfigPane::GameCubeConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent, id) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index a6432edecb..c894c6b9ce 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -285,7 +285,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) const wxString path = wxFileSelector( _("Load map file"), File::GetUserPath(D_MAPS_IDX), title_id_str + ".map", ".map", - "Dolphin Map File (*.map)|*.map|All files (*.*)|*.*", + _("Dolphin Map File (*.map)") + "|*.map|" + wxGetTranslation(wxALL_FILES), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path.IsEmpty()) @@ -302,7 +302,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) const wxString path = wxFileSelector( _("Load bad map file"), File::GetUserPath(D_MAPS_IDX), title_id_str + ".map", ".map", - "Dolphin Map File (*.map)|*.map|All files (*.*)|*.*", + _("Dolphin Map File (*.map)") + "|*.map|" + wxGetTranslation(wxALL_FILES), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path.IsEmpty()) @@ -322,7 +322,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) const wxString path = wxFileSelector( _("Save map file as"), File::GetUserPath(D_MAPS_IDX), title_id_str + ".map", ".map", - "Dolphin Map File (*.map)|*.map|All files (*.*)|*.*", + _("Dolphin Map File (*.map)") + "|*.map|" + wxGetTranslation(wxALL_FILES), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); if (!path.IsEmpty()) @@ -338,7 +338,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) const wxString path = wxFileSelector( _("Apply signature file"), wxEmptyString, wxEmptyString, wxEmptyString, - "Dolphin Symbol Rename File (*.sym)|*.sym", + _("Dolphin Symbol Rename File (*.sym)") + "|*.sym|" + wxGetTranslation(wxALL_FILES), wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path.IsEmpty()) @@ -382,8 +382,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) wxString path = wxFileSelector( _("Save signature as"), File::GetSysDirectory(), wxEmptyString, wxEmptyString, - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); if (!path.IsEmpty()) { SignatureDB db; @@ -408,8 +408,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) wxString path = wxFileSelector( _("Append signature to"), File::GetSysDirectory(), wxEmptyString, wxEmptyString, - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_SAVE, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_SAVE, this); if (!path.IsEmpty()) { SignatureDB db; @@ -426,8 +426,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) { wxString path = wxFileSelector( _("Apply signature file"), File::GetSysDirectory(), wxEmptyString, wxEmptyString, - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_OPEN | wxFD_FILE_MUST_EXIST, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path.IsEmpty()) { SignatureDB db; @@ -442,15 +442,15 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) { wxString path1 = wxFileSelector( _("Choose priority input file"), File::GetSysDirectory(), wxEmptyString, wxEmptyString, - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_OPEN | wxFD_FILE_MUST_EXIST, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path1.IsEmpty()) { SignatureDB db; wxString path2 = wxFileSelector( _("Choose secondary input file"), File::GetSysDirectory(), wxEmptyString, wxEmptyString, - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_OPEN | wxFD_FILE_MUST_EXIST, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_OPEN | wxFD_FILE_MUST_EXIST, this); if (!path2.IsEmpty()) { db.Load(WxStrToStr(path2)); @@ -458,8 +458,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) path2 = wxFileSelector( _("Save combined output file as"), File::GetSysDirectory(), wxEmptyString, ".dsy", - "Dolphin Signature File (*.dsy)|*.dsy;", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, - this); + _("Dolphin Signature File (*.dsy)") + "|*.dsy|" + wxGetTranslation(wxALL_FILES), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); db.Save(WxStrToStr(path2)); db.List(); } diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 55b933cc63..cf2191c5c0 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1449,14 +1449,12 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event)) { wxString path = wxFileSelector(_("Select the save file"), wxEmptyString, wxEmptyString, wxEmptyString, - _("Wii save files (*.bin)|*.bin"), + _("Wii save files (*.bin)") + "|*.bin|" + wxGetTranslation(wxALL_FILES), wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this); if (!path.IsEmpty()) - { CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path)); - } } void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED (event)) @@ -1491,7 +1489,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event) wxString path = wxFileSelector( _("Select a Wii WAD file to install"), wxEmptyString, wxEmptyString, wxEmptyString, - "Wii WAD file (*.wad)|*.wad", + _("Wii WAD files (*.wad)") + "|*.wad|" + wxGetTranslation(wxALL_FILES), wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this); fileName = WxStrToStr(path); diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 25ae8b4ce6..0cc725c35f 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -983,7 +983,7 @@ void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED (event)) if (!iso) return; if (wxMessageBox(_("Are you sure you want to delete this file? It will be gone forever!"), - wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) + _("Warning"), wxYES_NO | wxICON_EXCLAMATION) == wxYES) { File::Delete(iso->GetFileName()); Update(); @@ -992,7 +992,7 @@ void CGameListCtrl::OnDeleteISO(wxCommandEvent& WXUNUSED (event)) else { if (wxMessageBox(_("Are you sure you want to delete these files?\nThey will be gone forever!"), - wxMessageBoxCaptionStr, wxYES_NO | wxICON_EXCLAMATION) == wxYES) + _("Warning"), wxYES_NO | wxICON_EXCLAMATION) == wxYES) { int selected = GetSelectedItemCount(); diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 3f2bd68eb3..000711b19e 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -77,8 +77,8 @@ static void InterpretDisplayListPreprocess(u32 address, u32 size) static void UnknownOpcode(u8 cmd_byte, void *buffer, bool preprocess) { // TODO(Omega): Maybe dump FIFO to file on this error - PanicAlert( - "GFX FIFO: Unknown Opcode (0x%02x @ %p, preprocessing=%s).\n" + PanicAlertT( + "GFX FIFO: Unknown Opcode (0x%02x @ %p, %s).\n" "This means one of the following:\n" "* The emulated GPU got desynced, disabling dual core can help\n" "* Command stream corrupted by some spurious memory bug\n" @@ -88,7 +88,7 @@ static void UnknownOpcode(u8 cmd_byte, void *buffer, bool preprocess) "Dolphin will now likely crash or hang. Enjoy." , cmd_byte, buffer, - preprocess ? "yes" : "no"); + preprocess ? "preprocess=true" : "preprocess=false"); { SCPFifoStruct &fifo = CommandProcessor::fifo;