Merge pull request #5267 from lioncash/localize

main: Make the loader error dialog fully translatable
This commit is contained in:
bunnei 2021-01-02 15:44:32 -08:00 committed by GitHub
commit 235b5d27ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 10 deletions

View File

@ -1045,20 +1045,23 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) {
break; break;
default: default:
if (static_cast<u32>(result) > if (result > Core::System::ResultStatus::ErrorLoader) {
static_cast<u32>(Core::System::ResultStatus::ErrorLoader)) {
const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader); const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader);
const u16 error_id = static_cast<u16>(result) - loader_id; const u16 error_id = static_cast<u16>(result) - loader_id;
const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id); const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id);
LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code); LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code);
QMessageBox::critical(
this, const auto title =
tr("Error while loading ROM! ").append(QString::fromStdString(error_code)), tr("Error while loading ROM! %1", "%1 signifies a numeric error code.")
QString::fromStdString(fmt::format( .arg(QString::fromStdString(error_code));
"{}<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the " const auto description =
tr("%1<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the "
"yuzu quickstart guide</a> to redump your files.<br>You can refer " "yuzu quickstart guide</a> to redump your files.<br>You can refer "
"to the yuzu wiki</a> or the yuzu Discord</a> for help.", "to the yuzu wiki</a> or the yuzu Discord</a> for help.",
static_cast<Loader::ResultStatus>(error_id)))); "%1 signifies a numeric error ID.")
.arg(error_id);
QMessageBox::critical(this, title, description);
} else { } else {
QMessageBox::critical( QMessageBox::critical(
this, tr("Error while loading ROM!"), this, tr("Error while loading ROM!"),