mirror of https://github.com/cutefishos/calamares
commit
87eb5300d2
@ -0,0 +1,45 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "TranslationFix.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QCoreApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
void
|
||||
fixButtonLabels( QMessageBox* box )
|
||||
{
|
||||
if ( !box )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
auto* button = box->button( sb );
|
||||
if ( button )
|
||||
{
|
||||
button->setText( QCoreApplication::translate( "StandardButtons", label ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
@ -0,0 +1,31 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBCALAMARESUI_WIDGETS_TRANSLATIONFIX_H
|
||||
#define LIBCALAMARESUI_WIDGETS_TRANSLATIONFIX_H
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QMessageBox;
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
/** @brief Fixes the labels on the standard buttons of the message box
|
||||
*
|
||||
* Updates OK / Cancel / Yes / No because there does not
|
||||
* seem to be a way to do so in the Retranslator code
|
||||
* (in libcalamares) since the translated strings may come
|
||||
* from a variety of platform-plugin sources and we can't
|
||||
* guess the context.
|
||||
*/
|
||||
void UIDLLEXPORT fixButtonLabels( QMessageBox* );
|
||||
} // namespace Calamares
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue