Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Mark translatable strings in Applications folder #1077

Merged
merged 4 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ void ctkCLModuleExplorerMainWindow::closeEvent(QCloseEvent *event)
{
QMessageBox::StandardButton button =
QMessageBox::warning(QApplication::activeWindow(),
QString("Closing %1 running modules").arg(runningFrontends.size()),
"Some modules are still running.\n"
"Closing the application will cancel all current computations.",
//: %1 is the number of running modules
tr("Closing %1 running modules").arg(runningFrontends.size()),
tr("Some modules are still running.\n"
"Closing the application will cancel all current computations."),
QMessageBox::Ok | QMessageBox::Cancel);
if (button == QMessageBox::Ok)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
ctkCmdLineModuleExplorerShowXmlAction::ctkCmdLineModuleExplorerShowXmlAction(QObject *parent)
: QAction(parent)
{
this->setText("Show XML Description");
this->setText(tr("Show XML Description"));

connect(this, SIGNAL(triggered()), SLOT(run()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ void ctkCmdLineModuleExplorerTabList::tabCloseRequested(int index)
{
QMessageBox::StandardButton button =
QMessageBox::warning(QApplication::topLevelWidgets().front(),
"Closing a running module",
"The module '" + frontend->moduleReference().description().title() + "' is still running.\n"
"Closing the tab will cancel the current computation.",
tr("Closing a running module"),
//: %1 is the module name
tr("The module '%1' is still running.\n"
"Closing the tab will cancel the current computation.")
.arg(frontend->moduleReference().description().title()),
QMessageBox::Ok | QMessageBox::Cancel);
if (button == QMessageBox::Ok)
{
Expand All @@ -107,9 +109,11 @@ void ctkCmdLineModuleExplorerTabList::tabCloseRequested(int index)
else
{
QMessageBox::information(QApplication::topLevelWidgets().front(),
"Closing not possible",
"The module '" + frontend->moduleReference().description().title() + "' is still running "
"and does not support being canceled.");
tr("Closing not possible"),
//: %1 is the module name
tr("The module '%1' is still running "
"and does not support being canceled.")
.arg(frontend->moduleReference().description().title()));
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <QApplication>
#include <QMessageBox>

QString ctkCmdLineModuleExplorerTreeWidget::CATEGORY_UNKNOWN = "Uncategorized";
QString ctkCmdLineModuleExplorerTreeWidget::CATEGORY_UNKNOWN = ctkCmdLineModuleExplorerTreeWidget::tr("Uncategorized");

class ctkCmdLineModuleTreeWidgetItem : public QStandardItem
{
Expand All @@ -64,7 +64,9 @@ class ctkCmdLineModuleTreeWidgetItem : public QStandardItem
if (!ModuleRef.xmlValidationErrorString().isEmpty())
{
this->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning));
toolTip += "\n\nWarning:\n\n" + ModuleRef.xmlValidationErrorString();
toolTip += QString("\n\n%1\n\n%2")
.arg(ctkCmdLineModuleExplorerTreeWidget::tr("Warning:"))
.arg(ModuleRef.xmlValidationErrorString());
}
this->setToolTip(toolTip);
}
Expand All @@ -85,7 +87,7 @@ ctkCmdLineModuleExplorerTreeWidget::ctkCmdLineModuleExplorerTreeWidget(QWidget *
, DefaultFrontendFactory(NULL)
{
this->ContextMenu = new QMenu(this);
this->ShowFrontendMenu = this->ContextMenu->addMenu("Create Frontend");
this->ShowFrontendMenu = this->ContextMenu->addMenu(tr("Create Frontend"));

this->ShowXmlAction = new ctkCmdLineModuleExplorerShowXmlAction(this);
this->ContextMenu->addAction(ShowXmlAction);
Expand Down Expand Up @@ -268,8 +270,13 @@ ctkCmdLineModuleFrontend* ctkCmdLineModuleExplorerTreeWidget::createFrontend(con
}
catch (const ctkException& e)
{
QMessageBox::information(this, "Frontend creation failed", "Creating a " + frontendFactory->name()
+ " frontend failed:\n\n" + e.what());
//: %1 is the frontend factory name and %2 is the error description
QMessageBox::information(this,
tr("Frontend creation failed"),
tr("Creating a %1 frontend failed:\n\n%2")
.arg(frontendFactory->name())
.arg(e.what())
);
return NULL;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Applications/ctkDICOMHost/ctkDICOMHostMainLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void ctkDICOMHostMainLogic::aboutToQuit()
void ctkDICOMHostMainLogic::configureHostedApp()
{
//qDebug() << "load button clicked";
AppFileName = QFileDialog::getOpenFileName(PlaceHolderForHostedApp,"Choose hosted application",QApplication::applicationDirPath());
AppFileName = QFileDialog::getOpenFileName(PlaceHolderForHostedApp,tr("Choose hosted application"),QApplication::applicationDirPath());
HostControls->setAppFileName(AppFileName);
emit SelectionValid(((this->Host) && (this->HostControls->validAppFileName()) && (ValidSelection)));
}
Expand Down Expand Up @@ -123,7 +123,7 @@ void ctkDICOMHostMainLogic::onTreeSelectionChanged(const QItemSelection & select

if(model && (model->data(index0,ctkDICOMModel::TypeRole) == static_cast<int>(ctkDICOMModel::SeriesType)))
{
QString s = "Series selected: ";
QString s = tr("Series selected: ");
QString seriesUID = model->data(index0,ctkDICOMModel::UIDRole).toString();
s.append(seriesUID);
SelectedFiles = DicomAppWidget->database()->filesForSeries(seriesUID);
Expand All @@ -133,7 +133,7 @@ void ctkDICOMHostMainLogic::onTreeSelectionChanged(const QItemSelection & select
}
}
if (ValidSelection==false)
emit TreeSelectionChanged("no series selected");
emit TreeSelectionChanged(tr("no series selected"));
emit SelectionValid(((this->Host) && (this->HostControls->validAppFileName()) && (ValidSelection)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char** argv)
else
{
s = QFileDialog::getOpenFileName( 0,
"Choose an image file", ".",
QFileDialog::tr("Choose an image file"), ".",
"DCM (*)"
);
if( s.size() == 0 )
Expand Down
2 changes: 1 addition & 1 deletion Applications/ctkEventBusDemo/ctkEventBusDemoMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void ctkEventBusDemoMainWindow::connectEvents() {

void ctkEventBusDemoMainWindow::sendEvent() {

QString textToDisplay("Me: ");
QString textToDisplay = tr("Me: ");
textToDisplay.append(ui->txtParameter->property("plainText").toString());
ui->textBrowser->append(textToDisplay);

Expand Down
2 changes: 1 addition & 1 deletion Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
void ctkHostAppExampleWidget::loadButtonClicked()
{
qDebug() << "load button clicked";
this->setAppFileName(QFileDialog::getOpenFileName(this,"Choose hosted application",QApplication::applicationDirPath()));
this->setAppFileName(QFileDialog::getOpenFileName(this,tr("Choose hosted application"),QApplication::applicationDirPath()));
}

//----------------------------------------------------------------------------
Expand Down
26 changes: 13 additions & 13 deletions Applications/ctkPluginBrowser/ctkPluginBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@
ctkPluginBrowser::ctkPluginBrowser(ctkPluginFramework* framework)
: framework(framework)
{
pluginEventTypeToString[ctkPluginEvent::INSTALLED] = "Installed";
pluginEventTypeToString[ctkPluginEvent::LAZY_ACTIVATION] = "Lazy Activation";
pluginEventTypeToString[ctkPluginEvent::RESOLVED] = "Resolved";
pluginEventTypeToString[ctkPluginEvent::STARTED] = "Started";
pluginEventTypeToString[ctkPluginEvent::STARTING] = "Starting";
pluginEventTypeToString[ctkPluginEvent::STOPPED] = "Stopped";
pluginEventTypeToString[ctkPluginEvent::STOPPING] = "Stopping";
pluginEventTypeToString[ctkPluginEvent::UNINSTALLED] = "Uninstalled";
pluginEventTypeToString[ctkPluginEvent::UNRESOLVED] = "Unresolved";
pluginEventTypeToString[ctkPluginEvent::UPDATED] = "Updated";
pluginEventTypeToString[ctkPluginEvent::INSTALLED] = tr("Installed");
pluginEventTypeToString[ctkPluginEvent::LAZY_ACTIVATION] = tr("Lazy Activation");
pluginEventTypeToString[ctkPluginEvent::RESOLVED] = tr("Resolved");
pluginEventTypeToString[ctkPluginEvent::STARTED] = tr("Started");
pluginEventTypeToString[ctkPluginEvent::STARTING] = tr("Starting");
pluginEventTypeToString[ctkPluginEvent::STOPPED] = tr("Stopped");
pluginEventTypeToString[ctkPluginEvent::STOPPING] = tr("Stopping");
pluginEventTypeToString[ctkPluginEvent::UNINSTALLED] = tr("Uninstalled");
pluginEventTypeToString[ctkPluginEvent::UNRESOLVED] = tr("Unresolved");
pluginEventTypeToString[ctkPluginEvent::UPDATED] = tr("Updated");

framework->getPluginContext()->connectFrameworkListener(this, SLOT(frameworkEvent(ctkPluginFrameworkEvent)));
framework->getPluginContext()->connectPluginListener(this, SLOT(pluginEvent(ctkPluginEvent)));
Expand Down Expand Up @@ -112,9 +112,9 @@ ctkPluginBrowser::ctkPluginBrowser(ctkPluginFramework* framework)
connect(ui.pluginResourcesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(dbResourceDoubleClicked(QModelIndex)));
connect(ui.qtResourcesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(qtResourceDoubleClicked(QModelIndex)));

startPluginNowAction = new QAction(QIcon(":/pluginbrowser/images/run-now.png"), "Start Plugin (ignore activation policy)", this);
startPluginAction = new QAction(QIcon(":/pluginbrowser/images/run.png"), "Start Plugin", this);
stopPluginAction = new QAction(QIcon(":/pluginbrowser/images/stop.png"), "Stop Plugin", this);
startPluginNowAction = new QAction(QIcon(":/pluginbrowser/images/run-now.png"), tr("Start Plugin (ignore activation policy)"), this);
startPluginAction = new QAction(QIcon(":/pluginbrowser/images/run.png"), tr("Start Plugin"), this);
stopPluginAction = new QAction(QIcon(":/pluginbrowser/images/stop.png"), tr("Stop Plugin"), this);

connect(startPluginNowAction, SIGNAL(triggered()), this, SLOT(startPluginNow()));
connect(startPluginAction, SIGNAL(triggered()), this, SLOT(startPlugin()));
Expand Down
20 changes: 10 additions & 10 deletions Applications/ctkPluginBrowser/ctkPluginTableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ QVariant ctkPluginTableModel::headerData(int section, Qt::Orientation orientatio
{
if (section == 0)
{
return QVariant("Plugin");
return QVariant(/*no tr*/"Plugin");
}
else if (section == 1)
{
return QVariant("Version");
return QVariant(/*no tr*/"Version");
}
else if (section == 2)
{
return QVariant("State");
return QVariant(/*no tr*/"State");
}
}

Expand All @@ -97,12 +97,12 @@ int ctkPluginTableModel::rowCount(const QModelIndex& parent) const

QString ctkPluginTableModel::getStringForState(const ctkPlugin::State state) const
{
static const QString uninstalled("UNINSTALLED");
static const QString installed("INSTALLED");
static const QString resolved("RESOLVED");
static const QString starting("STARTING");
static const QString stopping("STOPPING");
static const QString active("ACTIVE");
static const QString uninstalled = tr("UNINSTALLED");
static const QString installed = tr("INSTALLED");
static const QString resolved = tr("RESOLVED");
static const QString starting = tr("STARTING");
static const QString stopping = tr("STOPPING");
static const QString active = tr("ACTIVE");

switch(state)
{
Expand All @@ -112,7 +112,7 @@ QString ctkPluginTableModel::getStringForState(const ctkPlugin::State state) con
case ctkPlugin::STARTING: return starting;
case ctkPlugin::STOPPING: return stopping;
case ctkPlugin::ACTIVE: return active;
default: return QString("unknown");
default: return tr("unknown");
}
}

Expand Down
18 changes: 9 additions & 9 deletions Applications/ctkXnatTreeBrowser/ctkXnatTreeBrowserMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void ctkXnatTreeBrowserMainWindow::loginButtonPushed()
ui->treeView->reset();
delete m_Session;
m_Session = 0;
ui->loginButton->setText("Login");
ui->loginLabel->setText("Disconnected");
ui->loginButton->setText(tr("Login"));
ui->loginLabel->setText(tr("Disconnected"));
ui->downloadLabel->hide();
}
else
Expand All @@ -99,8 +99,8 @@ void ctkXnatTreeBrowserMainWindow::loginButtonPushed()
m_Session = loginDialog.session();
if (m_Session)
{
ui->loginButton->setText("Logout");
ui->loginLabel->setText(QString("Connected: %1").arg(m_Session->url().toString()));
ui->loginButton->setText(tr("Logout"));
ui->loginLabel->setText(tr("Connected: %1").arg(m_Session->url().toString()));
this->connect(m_Session, SIGNAL(timedOut()), this, SLOT(sessionTimedOutMsg()));
this->connect(m_Session, SIGNAL(aboutToTimeOut()), this, SLOT(sessionAboutToTimeOutMsg()));

Expand Down Expand Up @@ -192,18 +192,18 @@ void ctkXnatTreeBrowserMainWindow::sessionTimedOutMsg()
ui->treeView->reset();
delete m_Session;
m_Session = 0;
ui->loginButton->setText("Login");
ui->loginLabel->setText("Disconnected");
ui->loginButton->setText(tr("Login"));
ui->loginLabel->setText(tr("Disconnected"));
ui->downloadLabel->hide();
QMessageBox::warning(this, "Session Timeout", "The session timed out.");
QMessageBox::warning(this, tr("Session Timeout"), tr("The session timed out."));
}

void ctkXnatTreeBrowserMainWindow::sessionAboutToTimeOutMsg()
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setWindowTitle("Session Timeout Soon");
msgBox.setText("The session will time out in 1 minute.\nDo you want to renew the session?");
msgBox.setWindowTitle(tr("Session Timeout Soon"));
msgBox.setText(tr("The session will time out in 1 minute.\nDo you want to renew the session?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.show();
Expand Down
2 changes: 0 additions & 2 deletions Libs/Widgets/ctkBasePopupWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ void ctkBasePopupWidgetPrivate::hideAll()
// Qt::Toolip is preferred to Qt::Popup as it would close itself at the first
// click outside the widget (typically a click in the BaseWidget)
ctkBasePopupWidget::ctkBasePopupWidget(QWidget* parentWidget)
//: Superclass(QApplication::desktop()->screen(QApplication::desktop()->screenNumber(parentWidget)),
: Superclass(parentWidget,
PopupWindowType | Qt::FramelessWindowHint)
, d_ptr(new ctkBasePopupWidgetPrivate(*this))
Expand All @@ -474,7 +473,6 @@ ctkBasePopupWidget::ctkBasePopupWidget(QWidget* parentWidget)

// -------------------------------------------------------------------------
ctkBasePopupWidget::ctkBasePopupWidget(ctkBasePopupWidgetPrivate* pimpl, QWidget* parentWidget)
//: //Superclass(QApplication::desktop()->screen(QApplication::desktop()->screenNumber(parentWidget)),
: Superclass(parentWidget,
PopupWindowType | Qt::FramelessWindowHint)
, d_ptr(pimpl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ ctkDicomAppHosting::Status ctkDicomSoapStatus::getStatus(const QtSoapType& type)

//----------------------------------------------------------------------------
ctkDicomSoapUID::ctkDicomSoapUID(const QString& name, const QString& uid)
//: QtSoapSimpleType(QtSoapQName(name), uid)
: QtSoapStruct(QtSoapQName(name))
{
this->insert(new QtSoapSimpleType(QtSoapQName("Uid"),uid));
Expand Down
8 changes: 4 additions & 4 deletions Plugins/org.commontk.eventbus/ctkEventDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ctkBusEvent;
ctkBusEvent *properties = new ctkBusEvent(topic, ctkEventBus::ctkEventTypeLocal, ctkEventBus::ctkSignatureTypeSignal, static_cast<QObject*>(sender), signature); \
bool ok = ctkEventBus::ctkEventBusManager::instance()->addEventProperty(*properties);\
if(!ok) {\
qWarning("%s", tr("Some problem occourred during the signal registration with ID '%1'.").arg(topic).toUtf8().data());\
qWarning("%s", QString("Some problem occourred during the signal registration with ID '%1'.").arg(topic).toUtf8().data());\
if(properties) {delete properties; properties = NULL;} \
}\
}
Expand All @@ -52,7 +52,7 @@ class ctkBusEvent;
ctkBusEvent *properties = new ctkBusEvent(topic, ctkEventBus::ctkEventTypeRemote, ctkEventBus::ctkSignatureTypeSignal, static_cast<QObject*>(sender), signature); \
bool ok = ctkEventBus::ctkEventBusManager::instance()->addEventProperty(*properties);\
if(!ok) {\
qWarning("%s", tr("Some problem occourred during the signal registration with ID '%1'.").arg(topic).toUtf8().data());\
qWarning("%s", QString("Some problem occourred during the signal registration with ID '%1'.").arg(topic).toUtf8().data());\
if(properties) {delete properties; properties = NULL;} \
}\
}
Expand All @@ -62,7 +62,7 @@ class ctkBusEvent;
ctkBusEvent *properties = new ctkBusEvent(topic, ctkEventBus::ctkEventTypeLocal, ctkEventBus::ctkSignatureTypeCallback, static_cast<QObject*>(observer), signature); \
bool ok = ctkEventBus::ctkEventBusManager::instance()->addEventProperty(*properties);\
if(!ok) {\
qWarning("%s", tr("Some problem occourred during the callback registration with ID '%1'.").arg(topic).toUtf8().data());\
qWarning("%s", QString("Some problem occourred during the callback registration with ID '%1'.").arg(topic).toUtf8().data());\
if(properties) {delete properties; properties = NULL;} \
}\
}
Expand All @@ -72,7 +72,7 @@ class ctkBusEvent;
ctkBusEvent *properties = new ctkBusEvent(topic, ctkEventBus::ctkEventTypeRemote, ctkEventBus::ctkSignatureTypeCallback, static_cast<QObject*>(sender), signature); \
bool ok = ctkEventBus::ctkEventBusManager::instance()->addEventProperty(*properties);\
if(!ok) {\
qWarning("%s", tr("Some problem occourred during the callback registration with ID '%1'.").arg(topic).toUtf8().data());\
qWarning("%s", QString("Some problem occourred during the callback registration with ID '%1'.").arg(topic).toUtf8().data());\
if(properties) {delete properties; properties = NULL;} \
}\
}
Expand Down