From 70399955a0fb98ca855ddae22d6f74cf3786631c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 10:14:56 -0400 Subject: [PATCH 1/6] CheatsManager: Make use of plural variant of tr() Allows translators to specify different translations if the target languages have pluralization rules that differ from English. --- Source/Core/DolphinQt/CheatsManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/CheatsManager.cpp b/Source/Core/DolphinQt/CheatsManager.cpp index 1b626b968b..7c3e51a482 100644 --- a/Source/Core/DolphinQt/CheatsManager.cpp +++ b/Source/Core/DolphinQt/CheatsManager.cpp @@ -648,7 +648,7 @@ void CheatsManager::Update() return; } - m_result_label->setText(tr("%1 Match(es)").arg(m_results.size())); + m_result_label->setText(tr("%n Match(es)", "", static_cast(m_results.size()))); m_match_table->setRowCount(static_cast(m_results.size())); if (m_results.empty()) From a65fcb5e5b39319829686a6e2651d590004cf155 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 10:21:51 -0400 Subject: [PATCH 2/6] ConvertDialog: Provide complete translation string for conversion Gives the translator full control over the string's localization instead of only one part of it. --- Source/Core/DolphinQt/ConvertDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/ConvertDialog.cpp b/Source/Core/DolphinQt/ConvertDialog.cpp index 9be6d1bca1..b7bf614291 100644 --- a/Source/Core/DolphinQt/ConvertDialog.cpp +++ b/Source/Core/DolphinQt/ConvertDialog.cpp @@ -412,9 +412,9 @@ void ConvertDialog::Convert() if (m_files.size() > 1) { + // i18n: %1 is a filename. progress_dialog.GetRaw()->setLabelText( - tr("Converting...") + QLatin1Char{'\n'} + - QFileInfo(QString::fromStdString(original_path)).fileName()); + tr("Converting...\n%1").arg(QFileInfo(QString::fromStdString(original_path)).fileName())); } std::unique_ptr blob_reader; From 75b68c9e96674fe4eb968f20064d384037d18d44 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 10:43:32 -0400 Subject: [PATCH 3/6] GBAWidget: Add ellipses for option selections that require more input Makes the context menu selections consistent with the rest of the application. --- Source/Core/DolphinQt/GBAWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinQt/GBAWidget.cpp b/Source/Core/DolphinQt/GBAWidget.cpp index 1fc16d091f..93a9eef17d 100644 --- a/Source/Core/DolphinQt/GBAWidget.cpp +++ b/Source/Core/DolphinQt/GBAWidget.cpp @@ -353,7 +353,7 @@ void GBAWidget::contextMenuEvent(QContextMenuEvent* event) disconnect_action->setChecked(!m_force_disconnect); connect(disconnect_action, &QAction::triggered, this, &GBAWidget::ToggleDisconnect); - auto* load_action = new QAction(tr("L&oad ROM"), menu); + auto* load_action = new QAction(tr("L&oad ROM..."), menu); load_action->setEnabled(CanControlCore()); connect(load_action, &QAction::triggered, this, &GBAWidget::LoadROM); @@ -361,7 +361,7 @@ void GBAWidget::contextMenuEvent(QContextMenuEvent* event) unload_action->setEnabled(CanControlCore() && m_core_info.has_rom); connect(unload_action, &QAction::triggered, this, &GBAWidget::UnloadROM); - auto* card_action = new QAction(tr("&Scan e-Reader Card(s)"), menu); + auto* card_action = new QAction(tr("&Scan e-Reader Card(s)..."), menu); card_action->setEnabled(CanControlCore() && m_core_info.has_ereader); connect(card_action, &QAction::triggered, this, &GBAWidget::PromptForEReaderCards); @@ -370,10 +370,10 @@ void GBAWidget::contextMenuEvent(QContextMenuEvent* event) connect(reset_action, &QAction::triggered, this, &GBAWidget::ResetCore); auto* state_menu = new QMenu(tr("Save State"), menu); - auto* import_action = new QAction(tr("&Import State"), state_menu); + auto* import_action = new QAction(tr("&Import State..."), state_menu); import_action->setEnabled(CanControlCore()); connect(import_action, &QAction::triggered, this, [this] { DoState(false); }); - auto* export_state = new QAction(tr("&Export State"), state_menu); + auto* export_state = new QAction(tr("&Export State..."), state_menu); connect(export_state, &QAction::triggered, this, [this] { DoState(true); }); auto* mute_action = new QAction(tr("&Mute"), menu); From 47b40698bb5ce0da3e103c197bfe0268a840596c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 11:10:47 -0400 Subject: [PATCH 4/6] MainWindow: Fix typo in resource pack initialization error message occured -> occurred --- Source/Core/DolphinQt/MainWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index cd566b7624..b4fc3e7da4 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -255,8 +255,10 @@ MainWindow::MainWindow(std::unique_ptr boot_parameters, Settings::Instance().RefreshWidgetVisibility(); if (!ResourcePack::Init()) + { ModalMessageBox::critical(this, tr("Error"), - tr("Error occured while loading some texture packs")); + tr("Error occurred while loading some texture packs")); + } for (auto& pack : ResourcePack::GetPacks()) { From 89ceef2a8ad49e54c62d04c293910292325db977 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 11:13:53 -0400 Subject: [PATCH 5/6] MainWindow: Use MainWindow variant of tr() MainWindow derives from QMainWindow, so we can use tr() directly without the qualification. --- Source/Core/DolphinQt/MainWindow.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index b4fc3e7da4..8a687cef47 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1379,16 +1379,15 @@ bool MainWindow::NetPlayJoin() { if (Core::IsRunning()) { - ModalMessageBox::critical( - nullptr, QObject::tr("Error"), - QObject::tr("Can't start a NetPlay Session while a game is still running!")); + ModalMessageBox::critical(nullptr, tr("Error"), + tr("Can't start a NetPlay Session while a game is still running!")); return false; } if (m_netplay_dialog->isVisible()) { - ModalMessageBox::critical(nullptr, QObject::tr("Error"), - QObject::tr("A NetPlay Session is already in progress!")); + ModalMessageBox::critical(nullptr, tr("Error"), + tr("A NetPlay Session is already in progress!")); return false; } @@ -1447,16 +1446,15 @@ bool MainWindow::NetPlayHost(const UICommon::GameFile& game) { if (Core::IsRunning()) { - ModalMessageBox::critical( - nullptr, QObject::tr("Error"), - QObject::tr("Can't start a NetPlay Session while a game is still running!")); + ModalMessageBox::critical(nullptr, tr("Error"), + tr("Can't start a NetPlay Session while a game is still running!")); return false; } if (m_netplay_dialog->isVisible()) { - ModalMessageBox::critical(nullptr, QObject::tr("Error"), - QObject::tr("A NetPlay Session is already in progress!")); + ModalMessageBox::critical(nullptr, tr("Error"), + tr("A NetPlay Session is already in progress!")); return false; } @@ -1480,9 +1478,8 @@ bool MainWindow::NetPlayHost(const UICommon::GameFile& game) if (!Settings::Instance().GetNetPlayServer()->is_connected) { ModalMessageBox::critical( - nullptr, QObject::tr("Failed to open server"), - QObject::tr( - "Failed to listen on port %1. Is another instance of the NetPlay server running?") + nullptr, tr("Failed to open server"), + tr("Failed to listen on port %1. Is another instance of the NetPlay server running?") .arg(host_port)); NetPlayQuit(); return false; From 8c67f13256a1b6f709f9e2cd01776e9a26af0666 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 24 Aug 2021 11:31:05 -0400 Subject: [PATCH 6/6] ResourcePackManager: Translate unknown author string This is text that should be translated, since it'll show up as English for non-English speakers. --- Source/Core/DolphinQt/ResourcePackManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt/ResourcePackManager.cpp b/Source/Core/DolphinQt/ResourcePackManager.cpp index 8f7e0dd360..ed067ab5cd 100644 --- a/Source/Core/DolphinQt/ResourcePackManager.cpp +++ b/Source/Core/DolphinQt/ResourcePackManager.cpp @@ -108,13 +108,14 @@ void ResourcePackManager::RepopulateTable() for (int i = 0; i < size; i++) { const auto& pack = ResourcePack::GetPacks()[size - 1 - i]; - auto* manifest = pack.GetManifest(); + const auto* manifest = pack.GetManifest(); + const auto& authors = manifest->GetAuthors(); auto* logo_item = new QTableWidgetItem; auto* name_item = new QTableWidgetItem(QString::fromStdString(manifest->GetName())); auto* version_item = new QTableWidgetItem(QString::fromStdString(manifest->GetVersion())); - auto* author_item = new QTableWidgetItem( - QString::fromStdString(manifest->GetAuthors().value_or("Unknown author"))); + auto* author_item = + new QTableWidgetItem(authors ? QString::fromStdString(*authors) : tr("Unknown author")); auto* description_item = new QTableWidgetItem(QString::fromStdString(manifest->GetDescription().value_or(""))); auto* website_item =