Fix various translatable strings

Change-Id: I08e81f188a68c8e820f20a35249d1b318178a7b9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Eike Ziller
2024-06-26 14:15:33 +02:00
parent 269fc1fd6b
commit e20f33cd4c
14 changed files with 48 additions and 36 deletions

View File

@@ -55,12 +55,12 @@ static std::optional<QDomElement> documentElement(const FilePath &fileName)
{ {
QFile file(fileName.toString()); QFile file(fileName.toString());
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
MessageManager::writeDisrupting(Tr::tr("Cannot open: %1").arg(fileName.toUserOutput())); MessageManager::writeDisrupting(Tr::tr("Cannot open \"%1\".").arg(fileName.toUserOutput()));
return {}; return {};
} }
QDomDocument doc; QDomDocument doc;
if (!doc.setContent(file.readAll())) { if (!doc.setContent(file.readAll())) {
MessageManager::writeDisrupting(Tr::tr("Cannot parse: %1").arg(fileName.toUserOutput())); MessageManager::writeDisrupting(Tr::tr("Cannot parse \"%1\".").arg(fileName.toUserOutput()));
return {}; return {};
} }
return doc.documentElement(); return doc.documentElement();

View File

@@ -313,7 +313,7 @@ static GroupItem updateRecipe(const Storage<DialogStorage> &dialogStorage)
const QStringList args = {"--update", sdkRootArg()}; const QStringList args = {"--update", sdkRootArg()};
QuestionProgressDialog *dialog = dialogStorage->m_dialog.get(); QuestionProgressDialog *dialog = dialogStorage->m_dialog.get();
setupSdkProcess(args, &process, dialog, 0, 1); setupSdkProcess(args, &process, dialog, 0, 1);
dialog->appendMessage(Tr::tr("Updating installed packages....") + '\n', NormalMessageFormat); dialog->appendMessage(Tr::tr("Updating installed packages...") + '\n', NormalMessageFormat);
dialog->setProgress(0); dialog->setProgress(0);
}; };
const auto onDone = [dialogStorage](DoneWith result) { const auto onDone = [dialogStorage](DoneWith result) {

View File

@@ -69,7 +69,7 @@ ProjectTestSettingsWidget::ProjectTestSettingsWidget(Project *project)
m_pathFilters = new QTreeWidget; m_pathFilters = new QTreeWidget;
m_pathFilters->setHeaderHidden(true); m_pathFilters->setHeaderHidden(true);
m_pathFilters->setRootIsDecorated(false); m_pathFilters->setRootIsDecorated(false);
QLabel *filterLabel = new QLabel(Tr::tr("Wildcard expressions for filtering"), this); QLabel *filterLabel = new QLabel(Tr::tr("Wildcard expressions for filtering:"), this);
QPushButton *addFilter = new QPushButton(Tr::tr("Add"), this); QPushButton *addFilter = new QPushButton(Tr::tr("Add"), this);
QPushButton *removeFilter = new QPushButton(Tr::tr("Remove"), this); QPushButton *removeFilter = new QPushButton(Tr::tr("Remove"), this);
removeFilter->setEnabled(false); removeFilter->setEnabled(false);

View File

@@ -35,7 +35,7 @@ TestSettings::TestSettings()
useTimeout.setSettingsKey("UseTimeout"); useTimeout.setSettingsKey("UseTimeout");
useTimeout.setDefaultValue(false); useTimeout.setDefaultValue(false);
useTimeout.setLabelText(Tr::tr("Timeout")); useTimeout.setLabelText(Tr::tr("Timeout:"));
useTimeout.setToolTip(Tr::tr("Use a timeout while executing test cases.")); useTimeout.setToolTip(Tr::tr("Use a timeout while executing test cases."));
timeout.setSettingsKey("Timeout"); timeout.setSettingsKey("Timeout");

View File

@@ -879,17 +879,17 @@ public:
dashboardUrl.setQuery(search.toUrlQuery(QueryMode::FilterQuery)); dashboardUrl.setQuery(search.toUrlQuery(QueryMode::FilterQuery));
QMenu *menu = new QMenu; QMenu *menu = new QMenu;
auto action = new QAction(Tr::tr("Open issue in Dashboard"), menu); auto action = new QAction(Tr::tr("Open Issue in Dashboard"), menu);
menu->addAction(action); menu->addAction(action);
QObject::connect(action, &QAction::triggered, menu, [issueBaseUrl] { QObject::connect(action, &QAction::triggered, menu, [issueBaseUrl] {
QDesktopServices::openUrl(issueBaseUrl); QDesktopServices::openUrl(issueBaseUrl);
}); });
action = new QAction(Tr::tr("Open table in Dashboard"), menu); action = new QAction(Tr::tr("Open Table in Dashboard"), menu);
QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] { QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] {
QDesktopServices::openUrl(dashboardUrl); QDesktopServices::openUrl(dashboardUrl);
}); });
menu->addAction(action); menu->addAction(action);
action = new QAction(Tr::tr("Copy Dashboard link to clipboard"), menu); action = new QAction(Tr::tr("Copy Dashboard Link to Clipboard"), menu);
QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] { QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] {
if (auto clipboard = QGuiApplication::clipboard()) if (auto clipboard = QGuiApplication::clipboard())
clipboard->setText(dashboardUrl.toString()); clipboard->setText(dashboardUrl.toString());

View File

@@ -308,16 +308,17 @@ AxivionSettingsWidget::AxivionSettingsWidget()
auto addButton = new QPushButton(Tr::tr("Add..."), this); auto addButton = new QPushButton(Tr::tr("Add..."), this);
m_edit = new QPushButton(Tr::tr("Edit..."), this); m_edit = new QPushButton(Tr::tr("Edit..."), this);
m_remove = new QPushButton(Tr::tr("Remove"), this); m_remove = new QPushButton(Tr::tr("Remove"), this);
Column { Column{
Row { Row{
Form { Form{Tr::tr("Default dashboard server:"), m_dashboardServers, br},
Tr::tr("Default dashboard server"), m_dashboardServers, br st,
}, st, Column{addButton, m_edit, st, m_remove},
Column { addButton, m_edit, st, m_remove },
}, },
Space(10), br, Space(10),
Row { settings().highlightMarks }, st br,
}.attachTo(this); Row{settings().highlightMarks},
st}
.attachTo(this);
connect(addButton, &QPushButton::clicked, this, [this] { connect(addButton, &QPushButton::clicked, this, [this] {
// add an empty item unconditionally // add an empty item unconditionally
@@ -357,9 +358,10 @@ void AxivionSettingsWidget::updateEnabledStates()
void AxivionSettingsWidget::removeCurrentServerConfig() void AxivionSettingsWidget::removeCurrentServerConfig()
{ {
const QString config = m_dashboardServers->currentData().value<AxivionServer>().displayString(); const QString config = m_dashboardServers->currentData().value<AxivionServer>().displayString();
if (QMessageBox::question(ICore::dialogParent(), Tr::tr("Remove Server Configuration"), if (QMessageBox::question(
Tr::tr("Do you really want to remove the server configuration " ICore::dialogParent(),
"\"%1\"?").arg(config)) Tr::tr("Remove Server Configuration"),
Tr::tr("Remove the server configuration \"%1\"?").arg(config))
!= QMessageBox::Yes) { != QMessageBox::Yes) {
return; return;
} }

View File

@@ -110,7 +110,7 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(ICodeStylePreferenc
// clang-format off // clang-format off
Group globalSettingsGroupBox { Group globalSettingsGroupBox {
bindTo(&globalSettingsGroupBoxWidget), bindTo(&globalSettingsGroupBoxWidget),
title(Tr::tr("ClangFormat Settings:")), title(Tr::tr("ClangFormat Settings")),
Column { Column {
m_useGlobalSettings, m_useGlobalSettings,
Form { Form {

View File

@@ -518,7 +518,7 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
m_presetsData.configurePresets, m_presetsData.configurePresets,
jsonFile.parentDir())) { jsonFile.parentDir())) {
errorMessage = ::CMakeProjectManager::Tr::tr( errorMessage = ::CMakeProjectManager::Tr::tr(
"Invalid \"configurePresets\" section in %1 file") "Invalid \"configurePresets\" section in file \"%1\".")
.arg(jsonFile.fileName()); .arg(jsonFile.fileName());
return false; return false;
} }
@@ -527,14 +527,15 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
if (!parseBuildPresets(root.value("buildPresets"), if (!parseBuildPresets(root.value("buildPresets"),
m_presetsData.buildPresets, m_presetsData.buildPresets,
jsonFile.parentDir())) { jsonFile.parentDir())) {
errorMessage = ::CMakeProjectManager::Tr::tr("Invalid \"buildPresets\" section in %1 file.") errorMessage = ::CMakeProjectManager::Tr::tr(
"Invalid \"buildPresets\" section in file \"%1\".")
.arg(jsonFile.fileName()); .arg(jsonFile.fileName());
return false; return false;
} }
// optional // optional
if (!parseVendor(root.value("vendor"), m_presetsData.vendor)) { if (!parseVendor(root.value("vendor"), m_presetsData.vendor)) {
errorMessage = ::CMakeProjectManager::Tr::tr("Invalid \"vendor\" section in %1 file.") errorMessage = ::CMakeProjectManager::Tr::tr("Invalid \"vendor\" section in file \"%1\".")
.arg(jsonFile.fileName()); .arg(jsonFile.fileName());
} }

View File

@@ -47,7 +47,7 @@ class HeaderGuardExpander : public MacroExpander
public: public:
HeaderGuardExpander(const FilePath &filePath) : m_filePath(filePath) HeaderGuardExpander(const FilePath &filePath) : m_filePath(filePath)
{ {
setDisplayName(Tr::tr("Header file variables")); setDisplayName(Tr::tr("Header File Variables"));
registerFileVariables("Header", Tr::tr("Header file"), [this] { registerFileVariables("Header", Tr::tr("Header file"), [this] {
return m_filePath; return m_filePath;
}); });

View File

@@ -447,8 +447,10 @@ void ElementTasks::openLinkedFile(const qmt::MElement *element)
(void) Core::EditorManager::openEditor(filepath); (void) Core::EditorManager::openEditor(filepath);
} }
} else { } else {
QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Opening File"), QMessageBox::critical(
Tr::tr("File %1 does not exist.").arg(filepath.toUserOutput())); Core::ICore::dialogParent(),
Tr::tr("Opening File"),
Tr::tr("File \"%1\" does not exist.").arg(filepath.toUserOutput()));
} }
} }
} }

View File

@@ -257,8 +257,10 @@ void ExtPropertiesMView::onImagePathChanged(const QString &path)
assignModelElement<qmt::DObject, QImage>(m_diagramElements, SelectionSingle, image, assignModelElement<qmt::DObject, QImage>(m_diagramElements, SelectionSingle, image,
&qmt::DObject::image, &qmt::DObject::setImage); &qmt::DObject::image, &qmt::DObject::setImage);
} else { } else {
QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Selecting Image"), QMessageBox::critical(
Tr::tr("Unable to read image file %1").arg(path)); Core::ICore::dialogParent(),
Tr::tr("Selecting Image"),
Tr::tr("Unable to read image file \"%1\".").arg(path));
} }
} }
} }

View File

@@ -57,7 +57,7 @@ BuildPropertiesSettings::BuildPropertiesSettings()
buildDirectoryTemplate.setToolTip( buildDirectoryTemplate.setToolTip(
Tr::tr("Template used to construct the default build directory.<br><br>" Tr::tr("Template used to construct the default build directory.<br><br>"
"The default value can be set using the environment variable " "The default value can be set using the environment variable "
"<tt>%1</tt>") "<tt>%1</tt>.")
.arg(Constants::QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE)); .arg(Constants::QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE));
buildDirectoryTemplate.setUseResetButton(); buildDirectoryTemplate.setUseResetButton();

View File

@@ -310,10 +310,11 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget()
{ {
m_reaperTimeoutSpinBox = new QSpinBox; m_reaperTimeoutSpinBox = new QSpinBox;
m_reaperTimeoutSpinBox->setMinimum(1); m_reaperTimeoutSpinBox->setMinimum(1);
//: Suffix for "seconds"
m_reaperTimeoutSpinBox->setSuffix(Tr::tr("s")); m_reaperTimeoutSpinBox->setSuffix(Tr::tr("s"));
m_reaperTimeoutSpinBox->setToolTip( m_reaperTimeoutSpinBox->setToolTip(
Tr::tr("The amount of seconds to wait between a \"soft kill\" and a \"hard kill\" of a " Tr::tr("The amount of seconds to wait between a \"soft kill\" and a \"hard kill\" of a "
"running application")); "running application."));
m_currentDirectoryRadioButton = new QRadioButton(Tr::tr("Current directory")); m_currentDirectoryRadioButton = new QRadioButton(Tr::tr("Current directory"));
m_directoryRadioButton = new QRadioButton(Tr::tr("Directory")); m_directoryRadioButton = new QRadioButton(Tr::tr("Directory"));

View File

@@ -711,8 +711,11 @@ void SshProcessInterfacePrivate::start()
auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device); auto linuxDevice = std::dynamic_pointer_cast<const LinuxDevice>(m_device);
QTC_ASSERT(linuxDevice, handleDone(); return); QTC_ASSERT(linuxDevice, handleDone(); return);
if (linuxDevice->isDisconnected()) { if (linuxDevice->isDisconnected()) {
emit q->done({-1, QProcess::CrashExit, QProcess::FailedToStart, emit q->done(
Tr::tr("Device \"%1\" is disconnected").arg(linuxDevice->displayName())}); {-1,
QProcess::CrashExit,
QProcess::FailedToStart,
Tr::tr("Device \"%1\" is disconnected.").arg(linuxDevice->displayName())});
return; return;
} }
linuxDevice->connectionAccess() linuxDevice->connectionAccess()
@@ -1646,7 +1649,7 @@ private:
const expected_str<void> result = async.result(); const expected_str<void> result = async.result();
if (result) if (result)
emit progress( emit progress(
Tr::tr("Created directory: %1\n").arg(iteratorParentDirs->toUserOutput())); Tr::tr("Created directory: \"%1\".\n").arg(iteratorParentDirs->toUserOutput()));
else else
emit progress(result.error()); emit progress(result.error());
}; };
@@ -1665,7 +1668,8 @@ private:
++counter; ++counter;
if (result) { if (result) {
emit progress(Tr::tr("Copied %1/%2: %3 -> %4\n") //: %1/%2 = progress in the form 4/15, %3 and %4 = source and target file paths
emit progress(Tr::tr("Copied %1/%2: \"%3\" -> \"%4\".\n")
.arg(counter) .arg(counter)
.arg(m_setup.m_files.size()) .arg(m_setup.m_files.size())
.arg(iterator->m_source.toUserOutput()) .arg(iterator->m_source.toUserOutput())