Core: Make some additional OSD messages translatable

This commit is contained in:
Albert Liu 2020-10-22 02:07:48 -07:00
parent 2b2e2f7854
commit f69889264d
6 changed files with 27 additions and 17 deletions

View File

@ -100,10 +100,11 @@ void GPU_HW::UpdateHWSettings(bool* framebuffer_changed, bool* shaders_changed)
if (m_resolution_scale != resolution_scale)
{
g_host_interface->AddFormattedOSDMessage(10.0f, "Resolution scale set to %ux (display %ux%u, VRAM %ux%u)",
resolution_scale, m_crtc_state.display_vram_width * resolution_scale,
resolution_scale * m_crtc_state.display_vram_height,
VRAM_WIDTH * resolution_scale, VRAM_HEIGHT * resolution_scale);
g_host_interface->AddFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Resolution scale set to %ux (display %ux%u, VRAM %ux%u)"),
resolution_scale, m_crtc_state.display_vram_width * resolution_scale,
resolution_scale * m_crtc_state.display_vram_height, VRAM_WIDTH * resolution_scale,
VRAM_HEIGHT * resolution_scale);
}
m_resolution_scale = resolution_scale;

View File

@ -811,7 +811,8 @@ void HostInterface::ToggleSoftwareRendering()
const GPURenderer new_renderer = g_gpu->IsHardwareRenderer() ? GPURenderer::Software : g_settings.gpu_renderer;
AddFormattedOSDMessage(5.0f, "Switching to %s renderer...", Settings::GetRendererDisplayName(new_renderer));
AddFormattedOSDMessage(5.0f, TranslateString("OSDMessage", "Switching to %s renderer..."),
Settings::GetRendererDisplayName(new_renderer));
System::RecreateGPU(new_renderer);
}

View File

@ -295,15 +295,17 @@ bool MemoryCard::SaveIfChanged(bool display_osd_message)
{
if (display_osd_message)
{
g_host_interface->AddOSDMessage(
StringUtil::StdStringFromFormat("Failed to save memory card to '%s'", m_filename.c_str()), 20.0f);
g_host_interface->AddFormattedOSDMessage(
20.0f, g_host_interface->TranslateString("OSDMessage", "Failed to save memory card to '%s'"),
m_filename.c_str());
}
return false;
}
if (display_osd_message)
g_host_interface->AddOSDMessage(StringUtil::StdStringFromFormat("Saved memory card to '%s'", m_filename.c_str()));
g_host_interface->AddFormattedOSDMessage(
2.0f, g_host_interface->TranslateString("OSDMessage", "Saved memory card to '%s'"), m_filename.c_str());
return true;
}

View File

@ -59,7 +59,9 @@ bool Pad::DoState(StateWrapper& sw)
if (g_settings.load_devices_from_save_states)
{
g_host_interface->AddFormattedOSDMessage(
10.0f, "Save state contains controller type %s in port %u, but %s is used. Switching.",
10.0f,
g_host_interface->TranslateString(
"OSDMessage", "Save state contains controller type %s in port %u, but %s is used. Switching."),
Settings::GetControllerTypeName(state_controller_type), i + 1u,
Settings::GetControllerTypeName(controller_type));
@ -69,8 +71,9 @@ bool Pad::DoState(StateWrapper& sw)
}
else
{
g_host_interface->AddFormattedOSDMessage(10.0f, "Ignoring mismatched controller type %s in port %u.",
Settings::GetControllerTypeName(state_controller_type), i + 1u);
g_host_interface->AddFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Ignoring mismatched controller type %s in port %u."),
Settings::GetControllerTypeName(state_controller_type), i + 1u);
// we still need to read the save state controller state
if (state_controller_type != ControllerType::None)

View File

@ -1663,8 +1663,9 @@ bool RemoveMediaPathFromPlaylist(u32 index)
if (GetMediaPlaylistIndex() == index)
{
g_host_interface->AddFormattedOSDMessage(10.0f,
"Removing current media from playlist, removing media from CD-ROM.");
g_host_interface->AddFormattedOSDMessage(
10.0f,
g_host_interface->TranslateString("System", "Removing current media from playlist, removing media from CD-ROM."));
g_cdrom.RemoveMedia();
}
@ -1679,7 +1680,9 @@ bool ReplaceMediaPathFromPlaylist(u32 index, const std::string_view& path)
if (GetMediaPlaylistIndex() == index)
{
g_host_interface->AddFormattedOSDMessage(10.0f, "Changing current media from playlist, replacing current media.");
g_host_interface->AddFormattedOSDMessage(
10.0f,
g_host_interface->TranslateString("System", "Changing current media from playlist, replacing current media."));
g_cdrom.RemoveMedia();
s_media_playlist[index] = path;

View File

@ -2236,12 +2236,12 @@ bool CommonHostInterface::StartDumpingAudio(const char* filename)
if (g_spu.StartDumpingAudio(filename))
{
AddFormattedOSDMessage(5.0f, "Started dumping audio to '%s'.", filename);
AddFormattedOSDMessage(5.0f, TranslateString("OSDMessage", "Started dumping audio to '%s'."), filename);
return true;
}
else
{
AddFormattedOSDMessage(10.0f, "Failed to start dumping audio to '%s'.", filename);
AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Failed to start dumping audio to '%s'."), filename);
return false;
}
}
@ -2251,7 +2251,7 @@ void CommonHostInterface::StopDumpingAudio()
if (System::IsShutdown() || !g_spu.StopDumpingAudio())
return;
AddOSDMessage("Stopped dumping audio.", 5.0f);
AddOSDMessage(TranslateStdString("OSDMessage", "Stopped dumping audio."), 5.0f);
}
bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, bool full_resolution /* = true */,