OSD: More Translatable Strings

This commit is contained in:
KamFretoZ 2024-08-02 19:40:27 +07:00 committed by lightningterror
parent ad3e66f903
commit 27b681bb4c
6 changed files with 31 additions and 24 deletions

View File

@ -1151,16 +1151,16 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys){"Screenshot", TRANSLATE_NOOP("Hotkeys", "Graphic
return; return;
static constexpr std::array<const char*, static_cast<int>(GSInterlaceMode::Count)> option_names = {{ static constexpr std::array<const char*, static_cast<int>(GSInterlaceMode::Count)> option_names = {{
"Automatic", TRANSLATE_NOOP("Hotkeys", "Automatic"),
"Off", TRANSLATE_NOOP("Hotkeys", "Off"),
"Weave (Top Field First)", TRANSLATE_NOOP("Hotkeys", "Weave (Top Field First)"),
"Weave (Bottom Field First)", TRANSLATE_NOOP("Hotkeys", "Weave (Bottom Field First)"),
"Bob (Top Field First)", TRANSLATE_NOOP("Hotkeys", "Bob (Top Field First)"),
"Bob (Bottom Field First)", TRANSLATE_NOOP("Hotkeys", "Bob (Bottom Field First)"),
"Blend (Top Field First)", TRANSLATE_NOOP("Hotkeys", "Blend (Top Field First)"),
"Blend (Bottom Field First)", TRANSLATE_NOOP("Hotkeys", "Blend (Bottom Field First)"),
"Adaptive (Top Field First)", TRANSLATE_NOOP("Hotkeys", "Adaptive (Top Field First)"),
"Adaptive (Bottom Field First)", TRANSLATE_NOOP("Hotkeys", "Adaptive (Bottom Field First)"),
}}; }};
const GSInterlaceMode new_mode = static_cast<GSInterlaceMode>( const GSInterlaceMode new_mode = static_cast<GSInterlaceMode>(

View File

@ -364,6 +364,7 @@ void GSCapture::LogAVError(int errnum, const char* format, ...)
std::string GSCapture::GetCaptureTypeForMessage(bool capture_video, bool capture_audio) std::string GSCapture::GetCaptureTypeForMessage(bool capture_video, bool capture_audio)
{ {
return capture_video ? (capture_audio ? "capturing audio and video" : "capturing video") : "capturing audio"; return capture_video ? (capture_audio ? "capturing audio and video" : "capturing video") : "capturing audio";
return capture_video ? capture_audio ? TRANSLATE("GSCapture","capturing audio and video") : TRANSLATE("GSCapture","capturing video") : TRANSLATE("GSCapture","capturing audio");
} }
bool GSCapture::IsUsingHardwareVideoEncoding() bool GSCapture::IsUsingHardwareVideoEncoding()
@ -833,6 +834,7 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recommendedResolution, float
Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA, Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA,
fmt::format("Starting {} to '{}'.", GetCaptureTypeForMessage(capture_video, capture_audio), Path::GetFileName(s_filename)), fmt::format("Starting {} to '{}'.", GetCaptureTypeForMessage(capture_video, capture_audio), Path::GetFileName(s_filename)),
fmt::format(TRANSLATE_FS("GSCapture", "Starting {} to '{}'."), GetCaptureTypeForMessage(capture_video, capture_audio), Path::GetFileName(s_filename)),
Host::OSD_INFO_DURATION); Host::OSD_INFO_DURATION);
if (capture_audio) if (capture_audio)
@ -1250,12 +1252,14 @@ void GSCapture::InternalEndCapture(std::unique_lock<std::mutex>& lock)
Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA, Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA,
fmt::format( fmt::format(
"Stopped {} to '{}'.", GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()), Path::GetFileName(s_filename)), "Stopped {} to '{}'.", GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()), Path::GetFileName(s_filename)),
TRANSLATE_FS("GSCapture", "Stopped {} to '{}'."), GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()), Path::GetFileName(s_filename)),
Host::OSD_INFO_DURATION); Host::OSD_INFO_DURATION);
} }
else else
{ {
Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA, Host::AddIconOSDMessage("GSCapture", ICON_FA_CAMERA,
fmt::format("Aborted {} due to encoding error in '{}'.", GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()), fmt::format("Aborted {} due to encoding error in '{}'.", GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()),
fmt::format(TRANSLATE_FS("GSCapture", "Aborted {} due to encoding error in '{}'."), GetCaptureTypeForMessage(IsCapturingVideo(), IsCapturingAudio()),
Path::GetFileName(s_filename)), Path::GetFileName(s_filename)),
Host::OSD_INFO_DURATION); Host::OSD_INFO_DURATION);
} }

View File

@ -30,6 +30,7 @@ bool SaveStateBase::InputRecordingFreeze()
#include "GameDatabase.h" #include "GameDatabase.h"
#include "fmt/format.h" #include "fmt/format.h"
#include "GS.h" #include "GS.h"
#include "Host.h"
InputRecording g_InputRecording; InputRecording g_InputRecording;
@ -71,7 +72,7 @@ bool InputRecording::create(const std::string& fileName, const bool fromSaveStat
m_file.setGameName(VMManager::GetTitle(false)); m_file.setGameName(VMManager::GetTitle(false));
m_file.writeHeader(); m_file.writeHeader();
initializeState(); initializeState();
InputRec::log("Started new input recording"); InputRec::log(TRANSLATE_STR("InputRecording", "Started new input recording"), Host::OSD_INFO_DURATION);
InputRec::consoleLog(fmt::format("Filename {}", m_file.getFilename())); InputRec::consoleLog(fmt::format("Filename {}", m_file.getFilename()));
return true; return true;
} }
@ -90,7 +91,7 @@ bool InputRecording::play(const std::string& filename)
if (!FileSystem::FileExists(savestatePath.c_str())) if (!FileSystem::FileExists(savestatePath.c_str()))
{ {
InputRec::consoleLog(fmt::format("Could not locate savestate file at location - {}", savestatePath)); InputRec::consoleLog(fmt::format("Could not locate savestate file at location - {}", savestatePath));
InputRec::log("Savestate load failed"); InputRec::log(TRANSLATE_STR("InputRecording", "Savestate load failed for input recording"), Host::OSD_ERROR_DURATION);
m_file.close(); m_file.close();
return false; return false;
} }
@ -100,7 +101,7 @@ bool InputRecording::play(const std::string& filename)
const auto loaded = VMManager::LoadState(savestatePath.c_str()); const auto loaded = VMManager::LoadState(savestatePath.c_str());
if (!loaded) if (!loaded)
{ {
InputRec::log("Savestate load failed, unsupported version?"); InputRec::log(TRANSLATE_STR("InputRecording", "Savestate load failed for input recording, unsupported version?"), Host::OSD_ERROR_DURATION);
m_file.close(); m_file.close();
m_is_active = false; m_is_active = false;
return false; return false;
@ -117,7 +118,7 @@ bool InputRecording::play(const std::string& filename)
} }
m_controls.setReplayMode(); m_controls.setReplayMode();
initializeState(); initializeState();
InputRec::log("Replaying input recording"); InputRec::log(TRANSLATE_STR("InputRecording", "Replaying input recording"), Host::OSD_INFO_DURATION);
m_file.logRecordingMetadata(); m_file.logRecordingMetadata();
if (VMManager::GetTitle(false) != m_file.getGameName()) if (VMManager::GetTitle(false) != m_file.getGameName())
{ {
@ -135,12 +136,12 @@ void InputRecording::closeActiveFile()
if (m_file.close()) if (m_file.close())
{ {
m_is_active = false; m_is_active = false;
InputRec::log("Input recording stopped"); InputRec::log(TRANSLATE_STR("InputRecording", "Input recording stopped"), Host::OSD_ERROR_DURATION);
MTGS::PresentCurrentFrame(); MTGS::PresentCurrentFrame();
} }
else else
{ {
InputRec::log("Unable to stop input recording"); InputRec::log(TRANSLATE_STR("InputRecording", "Unable to stop input recording"), Host::OSD_ERROR_DURATION);
} }
} }
@ -228,7 +229,7 @@ void InputRecording::incFrameCounter()
if (m_frame_counter == std::numeric_limits<u32>::max()) if (m_frame_counter == std::numeric_limits<u32>::max())
{ {
// TODO - log the incredible achievment of playing for longer than 4 billion years, and end the recording InputRec::log(TRANSLATE_STR("InputRecording", "Congratulations, you've been playing for far too long and thus have reached the limit of input recording! Stopping recording now..."), Host::OSD_CRITICAL_ERROR_DURATION);
stop(); stop();
return; return;
} }

View File

@ -8,6 +8,7 @@
#include "InputRecordingControls.h" #include "InputRecordingControls.h"
#include "Utilities/InputRecordingLogger.h" #include "Utilities/InputRecordingLogger.h"
#include "Host.h"
#include "MTGS.h" #include "MTGS.h"
#include "VMManager.h" #include "VMManager.h"
@ -28,14 +29,14 @@ void InputRecordingControls::setRecordMode(bool waitForFrameToEnd)
if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused) if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused)
{ {
m_state = Mode::Recording; m_state = Mode::Recording;
InputRec::log("Record mode ON"); InputRec::log(TRANSLATE("InputRecordingControls","Record Mode Enabled"), Host::OSD_INFO_DURATION);
MTGS::PresentCurrentFrame(); MTGS::PresentCurrentFrame();
} }
else else
{ {
m_controlQueue.push([&]() { m_controlQueue.push([&]() {
m_state = Mode::Recording; m_state = Mode::Recording;
InputRec::log("Record mode ON"); InputRec::log(TRANSLATE("InputRecordingControls","Record Mode Enabled"), Host::OSD_INFO_DURATION);
}); });
} }
} }
@ -45,14 +46,14 @@ void InputRecordingControls::setReplayMode(bool waitForFrameToEnd)
if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused) if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused)
{ {
m_state = Mode::Replaying; m_state = Mode::Replaying;
InputRec::log("Replay mode ON"); InputRec::log(TRANSLATE("InputRecordingControls","Replay Mode Enabled"), Host::OSD_INFO_DURATION);
MTGS::PresentCurrentFrame(); MTGS::PresentCurrentFrame();
} }
else else
{ {
m_controlQueue.push([&]() { m_controlQueue.push([&]() {
m_state = Mode::Replaying; m_state = Mode::Replaying;
InputRec::log("Replay mode ON"); InputRec::log(TRANSLATE("InputRecordingControls","Record Mode Enabled"), Host::OSD_INFO_DURATION);
}); });
} }
} }

View File

@ -5,6 +5,7 @@
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include "common/Console.h" #include "common/Console.h"
#include "IconsPromptFont.h"
#include "GS.h" #include "GS.h"
#include "Host.h" #include "Host.h"
@ -12,12 +13,12 @@
namespace InputRec namespace InputRec
{ {
void log(const std::string& log) void log(const std::string& log, const float duration)
{ {
if (!log.empty()) if (!log.empty())
{ {
recordingConLog(fmt::format("[REC]: {}\n", log)); recordingConLog(fmt::format("[REC]: {}\n", log));
Host::AddOSDMessage(log, 15.0f); Host::AddIconOSDMessage("input_rec_log", ICON_PF_ANALOG_LEFT_RIGHT, log, duration);
} }
} }

View File

@ -9,7 +9,7 @@
namespace InputRec namespace InputRec
{ {
void log(const std::string& log); void log(const std::string& log, const float duration);
void consoleLog(const std::string& log); void consoleLog(const std::string& log);
void consoleMultiLog(const std::vector<std::string>& logs); void consoleMultiLog(const std::vector<std::string>& logs);
} // namespace inputRec } // namespace inputRec