diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index f6edbfc2a..57570ad64 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -24,6 +24,7 @@ #include "viewpages/BlankViewStep.h" #include "viewpages/ExecutionViewStep.h" #include "viewpages/ViewStep.h" +#include "widgets/TranslationFix.h" #include #include @@ -82,6 +83,12 @@ ViewManager::ViewManager( QObject* parent ) connect( JobQueue::instance(), &JobQueue::finished, this, &ViewManager::next ); CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels ); + +#ifdef PRESERVE_FOR_TRANSLATION_PURPOSES + tr( "&Yes" ); + tr( "&No" ); + tr( "&Close" ); +#endif } @@ -176,15 +183,13 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail { msgBox->setStandardButtons( QMessageBox::Yes | QMessageBox::No ); msgBox->setDefaultButton( QMessageBox::No ); - msgBox->button( QMessageBox::Yes )->setText( tr( "&Yes" ) ); - msgBox->button( QMessageBox::No )->setText( tr( "&No" ) ); } else { msgBox->setStandardButtons( QMessageBox::Close ); msgBox->setDefaultButton( QMessageBox::Close ); - msgBox->button( QMessageBox::Close )->setText( tr( "&Close" ) ); } + Calamares::fixButtonLabels( msgBox ); msgBox->show(); cDebug() << "Calamares will quit when the dialog closes."; @@ -516,8 +521,7 @@ ViewManager::confirmCancelInstallation() "The installer will quit and all changes will be lost." ); QMessageBox mb( QMessageBox::Question, title, question, QMessageBox::Yes | QMessageBox::No, m_widget ); mb.setDefaultButton( QMessageBox::No ); - mb.button( QMessageBox::Yes )->setText( tr( "&Yes" ) ); - mb.button( QMessageBox::No )->setText( tr( "&No" ) ); + Calamares::fixButtonLabels( &mb ); int response = mb.exec(); return response == QMessageBox::Yes; } diff --git a/src/libcalamaresui/widgets/TranslationFix.cpp b/src/libcalamaresui/widgets/TranslationFix.cpp index 6bd2900be..1262fceb5 100644 --- a/src/libcalamaresui/widgets/TranslationFix.cpp +++ b/src/libcalamaresui/widgets/TranslationFix.cpp @@ -24,8 +24,13 @@ fixButtonLabels( QMessageBox* box ) return; } - static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] - = { { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) } }; + static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] = { + { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, + { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, + { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, + { QMessageBox::Cancel, QT_TRANSLATE_NOOP( "StandardButtons", "&Cancel" ) }, + { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, + }; for ( auto [ sb, label ] : maps ) {