From 108b6759f7281b192d89667569ffd51d6a0d3f8a Mon Sep 17 00:00:00 2001 From: Emir SARI Date: Fri, 6 Oct 2023 03:26:40 +0300 Subject: [PATCH] Improve string formatting and context Improves some strings according to the KDE HIG, and specifies whether they are titles, buttons, or tooltips. --- src/calamares/CalamaresWindow.cpp | 15 ++++++++------- src/calamares/DebugWindow.cpp | 6 +++--- src/calamares/DebugWindow.ui | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 4bd89f5d0..722324846 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -154,9 +154,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, aboutDialog->setIcon( Calamares::defaultPixmap( Calamares::Information, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); CALAMARES_RETRANSLATE_FOR( - aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) ); + aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About", "@button" ) ); aboutDialog->setToolTip( - QCoreApplication::translate( "calamares-sidebar", "Show information about Calamares" ) ); ); + QCoreApplication::translate( "calamares-sidebar", "Show information about Calamares", "@tooltip" ) ); ); extraButtons->addWidget( aboutDialog ); aboutDialog->setFlat( true ); aboutDialog->setCheckable( true ); @@ -169,9 +169,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, debugWindowBtn->setIcon( Calamares::defaultPixmap( Calamares::Bugs, Calamares::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); CALAMARES_RETRANSLATE_FOR( - debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) ); + debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug", "@button" ) ); debugWindowBtn->setToolTip( - QCoreApplication::translate( "calamares-sidebar", "Show debug information" ) ); ); + QCoreApplication::translate( "calamares-sidebar", "Show debug information", "@tooltip" ) ); ); extraButtons->addWidget( debugWindowBtn ); debugWindowBtn->setFlat( true ); debugWindowBtn->setCheckable( true ); @@ -199,7 +199,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, { auto* back = new QPushButton( getButtonIcon( QStringLiteral( "go-previous" ) ), - QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Back" ), + QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Back", "@button" ), navigation ); back->setObjectName( "view-button-back" ); back->setEnabled( viewManager->backEnabled() ); @@ -215,7 +215,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, { auto* next = new QPushButton( getButtonIcon( QStringLiteral( "go-next" ) ), - QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Next" ), + QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Next", "@button" ), navigation ); next->setObjectName( "view-button-next" ); next->setEnabled( viewManager->nextEnabled() ); @@ -232,7 +232,7 @@ getWidgetNavigation( Calamares::DebugWindowManager*, { auto* quit = new QPushButton( getButtonIcon( QStringLiteral( "dialog-cancel" ) ), - QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Cancel" ), + QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Cancel", "@button" ), navigation ); quit->setObjectName( "view-button-cancel" ); QObject::connect( quit, &QPushButton::clicked, viewManager, &Calamares::ViewManager::quit ); @@ -398,6 +398,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) setWindowFlag( Qt::WindowCloseButtonHint, false ); } + // %1 is the distribution name CALAMARES_RETRANSLATE( const auto* branding = Calamares::Branding::instance(); setWindowTitle( Calamares::Settings::instance()->isSetupMode() ? tr( "%1 Setup Program" ).arg( branding->productName() ) diff --git a/src/calamares/DebugWindow.cpp b/src/calamares/DebugWindow.cpp index 2e69a9568..7321e9102 100644 --- a/src/calamares/DebugWindow.cpp +++ b/src/calamares/DebugWindow.cpp @@ -161,7 +161,7 @@ DebugWindow::DebugWindow() m_ui->sendLogButton->setVisible( Calamares::Paste::isEnabled() ); connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { Calamares::Paste::doLogUploadUI( this ); } ); - CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); ); + CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug Information", "@title" ) ); ); } void @@ -232,8 +232,8 @@ void DebugWindowManager::about() { QString title = Calamares::Settings::instance()->isSetupMode() - ? QCoreApplication::translate( "WelcomePage", "About %1 setup" ) - : QCoreApplication::translate( "WelcomePage", "About %1 installer" ); + ? QCoreApplication::translate( "WelcomePage", "About %1 Setup", "@title" ) + : QCoreApplication::translate( "WelcomePage", "About %1 Installer", "@title" ); QMessageBox mb( QMessageBox::Information, title.arg( CALAMARES_APPLICATION_NAME ), Calamares::aboutString().arg( Calamares::Branding::instance()->versionedName() ), diff --git a/src/calamares/DebugWindow.ui b/src/calamares/DebugWindow.ui index 2547ebd3d..16cc4a48f 100644 --- a/src/calamares/DebugWindow.ui +++ b/src/calamares/DebugWindow.ui @@ -99,7 +99,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - Crashes Calamares, so that Dr. Konqui can look at it. + Crashes Calamares, so that Dr. Konqi can look at it. Crash now