Merge pull request #3270 from JosJuice/more-translations

Mark more strings for translation
This commit is contained in:
Markus Wick 2015-12-15 18:13:26 +01:00
commit e4b83d17bf
12 changed files with 54 additions and 42 deletions

View File

@ -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

View File

@ -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_) \

View File

@ -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, ...)

View File

@ -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

View File

@ -36,7 +36,7 @@ static const char* const named_buttons[] =
"Y",
"Z",
_trans("Start"),
"Mic"
_trans("Mic")
};
static const char* const named_triggers[] =

View File

@ -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);
}

View File

@ -182,7 +182,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;
@ -219,7 +219,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)
{
@ -312,7 +313,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;
}
@ -355,7 +356,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;

View File

@ -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)

View File

@ -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();
}

View File

@ -1451,14 +1451,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))
@ -1493,7 +1491,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);

View File

@ -1030,7 +1030,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();
@ -1039,7 +1039,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();

View File

@ -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;