Qt: Translatification

This commit is contained in:
KamFretoZ 2024-03-28 23:26:57 +07:00 committed by Connor McLaughlin
parent 72e8ba2203
commit eafdd8bc76
4 changed files with 31 additions and 32 deletions

View File

@ -269,7 +269,7 @@ void SettingsWindow::onRestoreDefaultsClicked()
QMessageBox msgbox(this); QMessageBox msgbox(this);
msgbox.setIcon(QMessageBox::Question); msgbox.setIcon(QMessageBox::Question);
msgbox.setWindowTitle(tr("Confirm Restore Defaults")); msgbox.setWindowTitle(tr("Confirm Restore Defaults"));
msgbox.setText(tr("Are you sure you want to restore the default settings? Any preferences will be lost.")); msgbox.setText(tr("Are you sure you want to restore the default settings? Any existing preferences will be lost."));
QCheckBox* ui_cb = new QCheckBox(tr("Reset UI Settings"), &msgbox); QCheckBox* ui_cb = new QCheckBox(tr("Reset UI Settings"), &msgbox);
msgbox.setCheckBox(ui_cb); msgbox.setCheckBox(ui_cb);

View File

@ -310,8 +310,8 @@ bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* b
if (!res) if (!res)
{ {
Host::ReportErrorAsync( Host::ReportErrorAsync(
"Error", fmt::format("Failed to create render device. This may be due to your GPU not supporting the " "Error", fmt::format(TRANSLATE_FS("GS","Failed to create render device. This may be due to your GPU not supporting the "
"chosen renderer ({}), or because your graphics drivers need to be updated.", "chosen renderer ({}), or because your graphics drivers need to be updated."),
Pcsx2Config::GSOptions::GetRendererName(GSConfig.Renderer))); Pcsx2Config::GSOptions::GetRendererName(GSConfig.Renderer)));
return false; return false;
} }

View File

@ -8,6 +8,7 @@
#include "common/Assertions.h" #include "common/Assertions.h"
#include "common/Console.h" #include "common/Console.h"
#include "common/Error.h"
#include "common/FileSystem.h" #include "common/FileSystem.h"
#include "common/Path.h" #include "common/Path.h"
#include "common/StringUtil.h" #include "common/StringUtil.h"
@ -278,14 +279,11 @@ void FileMemoryCard::Open()
if (FileSystem::GetPathFileSize(fname.c_str()) <= 0) if (FileSystem::GetPathFileSize(fname.c_str()) <= 0)
{ {
// FIXME : Ideally this should prompt the user for the size of the
// memory card file they would like to create, instead of trying to
// create one automatically.
if (!Create(fname.c_str(), 8)) if (!Create(fname.c_str(), 8))
{ {
Host::ReportFormattedErrorAsync("Memory Card", "Could not create a memory card: \n\n%s\n\n", Host::ReportErrorAsync(TRANSLATE_SV("MemoryCard", "Memory Card Creation Failed"),
fname.c_str()); fmt::format(TRANSLATE_FS("MemoryCard", "Could not create the memory card:\n{}"),
fname));
} }
} }
@ -309,17 +307,12 @@ void FileMemoryCard::Open()
if (!m_file[slot]) if (!m_file[slot])
{ {
// Translation note: detailed description should mention that the memory card will be disabled Host::ReportErrorAsync(TRANSLATE_SV("MemoryCard", "Memory Card Read Failed"),
// for the duration of this session. fmt::format(TRANSLATE_FS("MemoryCard", "Unable to access memory card:\n\n{}\n\n"
Host::ReportFormattedErrorAsync("Memory Card", "Access denied to memory card: \n\n%s\n\n" "Another instance of PCSX2 may be using this memory card "
"Another instance of PCSX2 may be using this memory card. Close any other instances of PCSX2, or restart your computer.%s", "or the memory card is stored in a write-protected folder.\n"
fname.c_str(), "Close any other instances of PCSX2, or restart your computer.\n"),
#ifdef WIN32 fname));
"\n\nIf your memory card is in a write-protected folder such as \"Program Files\" or \"Program Files (x86)\", move it to another folder, such as \"Documents\" or \"Desktop\"."
#else
""
#endif
);
} }
else // Load checksum else // Load checksum
{ {
@ -335,7 +328,7 @@ void FileMemoryCard::Open()
{ {
const size_t read_result = std::fread(&m_chksum[slot], sizeof(m_chksum[slot]), 1, m_file[slot]); const size_t read_result = std::fread(&m_chksum[slot], sizeof(m_chksum[slot]), 1, m_file[slot]);
if (read_result == 0) if (read_result == 0)
Host::ReportFormattedErrorAsync("Memory Card", "Error reading memcard.\n"); Host::ReportErrorAsync("Memory Card Read Failed", "Error reading memory card.");
} }
} }
} }
@ -477,7 +470,7 @@ s32 FileMemoryCard::Save(uint slot, const u8* src, u32 adr, int size)
const size_t read_result = std::fread(m_currentdata.data(), size, 1, mcfp); const size_t read_result = std::fread(m_currentdata.data(), size, 1, mcfp);
if (read_result == 0) if (read_result == 0)
Host::ReportFormattedErrorAsync("Memory Card", "Error reading memcard.\n"); Host::ReportErrorAsync("Memory Card Read Failed", "Error reading memory card.");
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
@ -938,17 +931,19 @@ bool FileMcd_CreateNewCard(const std::string_view& name, MemoryCardType type, Me
{ {
Console.WriteLn("(FileMcd) Creating new PS2 folder memory card: '%.*s'", static_cast<int>(name.size()), name.data()); Console.WriteLn("(FileMcd) Creating new PS2 folder memory card: '%.*s'", static_cast<int>(name.size()), name.data());
if (!FileSystem::CreateDirectoryPath(full_path.c_str(), false)) Error error;
if (!FileSystem::CreateDirectoryPath(full_path.c_str(), false, &error))
{ {
Host::ReportFormattedErrorAsync("Memory Card Creation Failed", "Failed to create directory '%s'.", full_path.c_str()); Host::ReportErrorAsync("Memory Card Creation Failed",
fmt::format("Failed to create directory. The error was:\n{}", error.GetDescription()));
return false; return false;
} }
// write the superblock // write the superblock
auto fp = FileSystem::OpenManagedCFile(Path::Combine(full_path, s_folder_mem_card_id_file).c_str(), "wb"); auto fp = FileSystem::OpenManagedCFile(Path::Combine(full_path, s_folder_mem_card_id_file).c_str(), "wb", &error);
if (!fp) if (!fp)
{ {
Host::ReportFormattedErrorAsync("Memory Card Creation Failed", "Failed to write memory card folder superblock '%s'.", full_path.c_str()); Host::ReportErrorAsync("Memory Card Creation Failed", fmt::format("Failed to create superblock. The error was:\n{}", error.GetDescription()));
return false; return false;
} }
@ -967,10 +962,12 @@ bool FileMcd_CreateNewCard(const std::string_view& name, MemoryCardType type, Me
if (!isPSX && size == 0) if (!isPSX && size == 0)
return false; return false;
auto fp = FileSystem::OpenManagedCFile(full_path.c_str(), "wb"); Error error;
auto fp = FileSystem::OpenManagedCFile(full_path.c_str(), "wb", &error);
if (!fp) if (!fp)
{ {
Host::ReportFormattedErrorAsync("Memory Card Creation Failed", "Failed to open file '%s'.", full_path.c_str()); Host::ReportErrorAsync(TRANSLATE_SV("MemoryCard", "Memory Card Creation Failed"),
fmt::format(TRANSLATE_FS("MemoryCard", "Failed to create memory card. The error was:\n{}"), error.GetDescription()));
return false; return false;
} }
@ -987,7 +984,8 @@ bool FileMcd_CreateNewCard(const std::string_view& name, MemoryCardType type, Me
{ {
if (std::fwrite(buf, sizeof(buf), 1, fp.get()) != 1) if (std::fwrite(buf, sizeof(buf), 1, fp.get()) != 1)
{ {
Host::ReportFormattedErrorAsync("Memory Card Creation Failed", "Failed to write file '%s'.", full_path.c_str()); Host::ReportErrorAsync("Memory Card Creation Failed",
fmt::format("Failed to write memory card file:\n{}", full_path));
return false; return false;
} }
} }
@ -1007,7 +1005,8 @@ bool FileMcd_CreateNewCard(const std::string_view& name, MemoryCardType type, Me
{ {
if (std::fwrite(buf, sizeof(buf), 1, fp.get()) != 1) if (std::fwrite(buf, sizeof(buf), 1, fp.get()) != 1)
{ {
Host::ReportFormattedErrorAsync("Memory Card Creation Failed", "Failed to write file '%s'.", full_path.c_str()); Host::ReportErrorAsync("Memory Card Creation Failed",
fmt::format("Failed to write memory card file:\n{}", full_path));
return false; return false;
} }
} }

View File

@ -1702,7 +1702,7 @@ bool VMManager::DoLoadState(const char* filename)
Error error; Error error;
if (!SaveState_UnzipFromDisk(filename, &error)) if (!SaveState_UnzipFromDisk(filename, &error))
{ {
Host::ReportErrorAsync("Failed to load save state", error.GetDescription()); Host::ReportErrorAsync(TRANSLATE_SV("VMManager","Failed to load save state"), error.GetDescription());
return false; return false;
} }