[partition] Translate button texts in warning boxes

This commit is contained in:
Adriaan de Groot 2021-09-08 10:58:38 +02:00
parent 6e0a8d8ca1
commit 226419f794
2 changed files with 49 additions and 29 deletions

View File

@ -30,6 +30,7 @@
#include "utils/QtCompat.h" #include "utils/QtCompat.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "utils/Variant.h" #include "utils/Variant.h"
#include "widgets/TranslationFix.h"
#include "widgets/WaitingWidget.h" #include "widgets/WaitingWidget.h"
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
@ -51,7 +52,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_waitingWidget = new WaitingWidget( QString() ); m_waitingWidget = new WaitingWidget( QString() );
m_widget->addWidget( m_waitingWidget ); 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! m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first. // 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" ); message = tr( "No EFI system partition configured" );
} }
else if ( !(okType && okSize && okFlag ) ) else if ( !( okType && okSize && okFlag ) )
{ {
message = tr( "EFI system partition configured incorrectly" ); message = tr( "EFI system partition configured incorrectly" );
} }
if ( !esp || !(okType&&okSize &&okFlag)) { if ( !esp || !( okType && okSize && okFlag ) )
description = tr( "An EFI system partition is necessary to start %1." {
"<br/><br/>" description = tr( "An EFI system partition is necessary to start %1."
"To configure an EFI system partition, go back and " "<br/><br/>"
"select or create a suitable filesystem.").arg( branding->shortProductName() ); "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"; cDebug() << o << "No ESP mounted";
description.append(' '); description.append( ' ' );
description.append(tr("The filesystem must be mounted on <strong>%1</strong>.").arg(espMountPoint)); description.append(
tr( "The filesystem must be mounted on <strong>%1</strong>." ).arg( espMountPoint ) );
} }
if (!okType) { if ( !okType )
{
cDebug() << o << "ESP wrong type"; cDebug() << o << "ESP wrong type";
description.append(' '); description.append( ' ' );
description.append(tr("The filesystem must have type FAT32.")); description.append( tr( "The filesystem must have type FAT32." ) );
} }
if (!okSize) { if ( !okSize )
{
cDebug() << o << "ESP too small"; cDebug() << o << "ESP too small";
description.append(' '); description.append( ' ' );
description.append(tr("The filesystem must be at least %1 MiB in size.").arg( PartUtils::efiFilesystemMinimumSize() )); 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"; cDebug() << o << "ESP missing flag";
description.append(' '); description.append( ' ' );
description.append(tr("The filesystem must have flag <strong>%1</strong> set.").arg(PartitionTable::flagName( espFlag ))); description.append( tr( "The filesystem must have flag <strong>%1</strong> set." )
.arg( PartitionTable::flagName( espFlag ) ) );
} }
if (!description.isEmpty()) { if ( !description.isEmpty() )
{
description.append( "<br/><br/>" ); description.append( "<br/><br/>" );
description.append( tr( description.append( tr( "You can continue without setting up an EFI system "
"You can continue without setting up an EFI system " "partition but your system may fail to start." ) );
"partition but your system may fail to start." ));
} }
if ( !message.isEmpty() ) 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 else
@ -591,7 +603,10 @@ PartitionViewStep::onLeave()
"to start %1 on a BIOS system with GPT." ) "to start %1 on a BIOS system with GPT." )
.arg( branding->shortProductName() ); .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 <strong>Encrypt</strong> " "recreate it, selecting <strong>Encrypt</strong> "
"in the partition creation window." ); "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();
} }
} }
} }

View File

@ -258,13 +258,16 @@ PartitionPage::checkCanCreate( Device* device )
if ( ( table->numPrimaries() >= table->maxPrimaries() ) && !table->hasExtended() ) if ( ( table->numPrimaries() >= table->maxPrimaries() ) && !table->hasExtended() )
{ {
QMessageBox::warning( QMessageBox mb(
this, QMessageBox::Warning,
tr( "Can not create new partition" ), tr( "Can not create new partition" ),
tr( "The partition table on %1 already has %2 primary partitions, and no more can be added. " 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." ) "Please remove one primary partition and add an extended partition, instead." )
.arg( device->name() ) .arg( device->name() )
.arg( table->numPrimaries() ) ); .arg( table->numPrimaries() ),
QMessageBox::Ok );
Calamares::fixButtonLabels( &mb );
mb.exec();
return false; return false;
} }
return true; return true;