From 226419f7947a8d0f86b6de58e6ec389eeb9766ca Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Sep 2021 10:58:38 +0200 Subject: [PATCH] [partition] Translate button texts in warning boxes --- src/modules/partition/PartitionViewStep.cpp | 69 +++++++++++++-------- src/modules/partition/gui/PartitionPage.cpp | 9 ++- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index 1fe7bdfab..c17954810 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -30,6 +30,7 @@ #include "utils/QtCompat.h" #include "utils/Retranslator.h" #include "utils/Variant.h" +#include "widgets/TranslationFix.h" #include "widgets/WaitingWidget.h" #include @@ -51,7 +52,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent ) m_waitingWidget = new WaitingWidget( QString() ); m_widget->addWidget( m_waitingWidget ); - CALAMARES_RETRANSLATE( if (m_waitingWidget) { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } ); + CALAMARES_RETRANSLATE( + if ( m_waitingWidget ) { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } ); m_core = new PartitionCoreModule( this ); // Unusable before init is complete! // We're not done loading, but we need the configuration map first. @@ -527,47 +529,57 @@ PartitionViewStep::onLeave() { message = tr( "No EFI system partition configured" ); } - else if ( !(okType && okSize && okFlag ) ) + else if ( !( okType && okSize && okFlag ) ) { message = tr( "EFI system partition configured incorrectly" ); } - if ( !esp || !(okType&&okSize &&okFlag)) { - description = tr( "An EFI system partition is necessary to start %1." - "

" - "To configure an EFI system partition, go back and " - "select or create a suitable filesystem.").arg( branding->shortProductName() ); + if ( !esp || !( okType && okSize && okFlag ) ) + { + description = tr( "An EFI system partition is necessary to start %1." + "

" + "To configure an EFI system partition, go back and " + "select or create a suitable filesystem." ) + .arg( branding->shortProductName() ); } - if (!esp) { + if ( !esp ) + { cDebug() << o << "No ESP mounted"; - description.append(' '); - description.append(tr("The filesystem must be mounted on %1.").arg(espMountPoint)); + description.append( ' ' ); + description.append( + tr( "The filesystem must be mounted on %1." ).arg( espMountPoint ) ); } - if (!okType) { + if ( !okType ) + { cDebug() << o << "ESP wrong type"; - description.append(' '); - description.append(tr("The filesystem must have type FAT32.")); + description.append( ' ' ); + description.append( tr( "The filesystem must have type FAT32." ) ); } - if (!okSize) { + if ( !okSize ) + { cDebug() << o << "ESP too small"; - description.append(' '); - description.append(tr("The filesystem must be at least %1 MiB in size.").arg( PartUtils::efiFilesystemMinimumSize() )); + description.append( ' ' ); + description.append( tr( "The filesystem must be at least %1 MiB in size." ) + .arg( PartUtils::efiFilesystemMinimumSize() ) ); } - if (!okFlag) + if ( !okFlag ) { cDebug() << o << "ESP missing flag"; - description.append(' '); - description.append(tr("The filesystem must have flag %1 set.").arg(PartitionTable::flagName( espFlag ))); + description.append( ' ' ); + description.append( tr( "The filesystem must have flag %1 set." ) + .arg( PartitionTable::flagName( espFlag ) ) ); } - if (!description.isEmpty()) { + if ( !description.isEmpty() ) + { description.append( "

" ); - description.append( tr( - "You can continue without setting up an EFI system " - "partition but your system may fail to start." )); + description.append( tr( "You can continue without setting up an EFI system " + "partition but your system may fail to start." ) ); } if ( !message.isEmpty() ) { - QMessageBox::warning( m_manualPartitionPage, message, description ); + QMessageBox mb( QMessageBox::Warning, message, description, QMessageBox::Ok, m_manualPartitionPage ); + Calamares::fixButtonLabels( &mb ); + mb.exec(); } } else @@ -591,7 +603,10 @@ PartitionViewStep::onLeave() "to start %1 on a BIOS system with GPT." ) .arg( branding->shortProductName() ); - QMessageBox::information( m_manualPartitionPage, message, description ); + QMessageBox mb( + QMessageBox::Information, message, description, QMessageBox::Ok, m_manualPartitionPage ); + Calamares::fixButtonLabels( &mb ); + mb.exec(); } } @@ -621,7 +636,9 @@ PartitionViewStep::onLeave() "recreate it, selecting Encrypt " "in the partition creation window." ); - QMessageBox::warning( m_manualPartitionPage, message, description ); + QMessageBox mb( QMessageBox::Warning, message, description, QMessageBox::Ok, m_manualPartitionPage ); + Calamares::fixButtonLabels( &mb ); + mb.exec(); } } } diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index d22f6f01d..c8a58272e 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -258,13 +258,16 @@ PartitionPage::checkCanCreate( Device* device ) if ( ( table->numPrimaries() >= table->maxPrimaries() ) && !table->hasExtended() ) { - QMessageBox::warning( - this, + QMessageBox mb( + QMessageBox::Warning, tr( "Can not create new partition" ), tr( "The partition table on %1 already has %2 primary partitions, and no more can be added. " "Please remove one primary partition and add an extended partition, instead." ) .arg( device->name() ) - .arg( table->numPrimaries() ) ); + .arg( table->numPrimaries() ), + QMessageBox::Ok ); + Calamares::fixButtonLabels( &mb ); + mb.exec(); return false; } return true;