Translations: Fix stray QApplication::translate() calls

For references to the module-own context, use Tr::tr().
For references to other modules, use the right context name (with "::"
prefix).

Change-Id: I6dce8f1ceccb23c44d93f1826402cd3be8e98e5a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2023-02-07 22:46:35 +01:00
parent 2356f28647
commit 9db70d8810
15 changed files with 26 additions and 31 deletions

View File

@@ -952,7 +952,7 @@ namespace ADS
const bool success = write(workspace, data, &errorString);
if (!success)
QMessageBox::critical(parent,
QCoreApplication::translate("Utils::FileSaverBase", "File Error"),
QCoreApplication::translate("::Utils", "File Error"),
errorString);
return success;
}

View File

@@ -121,8 +121,7 @@ void disableDiagnosticInCurrentProjectConfig(const ClangDiagnostic &diagnostic)
// Create copy if needed
if (config.isReadOnly()) {
const QString name = QCoreApplication::translate("ClangDiagnosticConfig",
"Project: %1 (based on %2)")
const QString name = Tr::tr("Project: %1 (based on %2)")
.arg(project->displayName(), config.displayName());
config = ClangDiagnosticConfigsModel::createCustomConfig(config, name);
}
@@ -141,9 +140,7 @@ void disableDiagnosticInCurrentProjectConfig(const ClangDiagnostic &diagnostic)
projectSettings.setDiagnosticConfigId(config.id());
// Notify the user about changed project specific settings
const QString text
= QCoreApplication::translate("ClangDiagnosticConfig",
"Changes applied in Projects Mode > Clang Code Model");
const QString text = Tr::tr("Changes applied in Projects Mode > Clang Code Model");
FadingIndicator::showText(Core::ICore::mainWindow(),
text,
FadingIndicator::SmallText);

View File

@@ -154,15 +154,14 @@ GenerateCompilationDbResult generateCompilationDB(QList<ProjectInfo::ConstPtr> p
FilePath clangIncludeDir)
{
QTC_ASSERT(!baseDir.isEmpty(), return GenerateCompilationDbResult(QString(),
QCoreApplication::translate("ClangUtils", "Could not retrieve build directory.")));
Tr::tr("Could not retrieve build directory.")));
QTC_ASSERT(!projectInfoList.isEmpty(),
return GenerateCompilationDbResult(QString(), "Could not retrieve project info."));
QTC_CHECK(baseDir.ensureWritableDir());
QFile compileCommandsFile(baseDir.pathAppended("compile_commands.json").toFSPathString());
const bool fileOpened = compileCommandsFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
if (!fileOpened) {
return GenerateCompilationDbResult(QString(),
QCoreApplication::translate("ClangUtils", "Could not create \"%1\": %2")
return GenerateCompilationDbResult(QString(), Tr::tr("Could not create \"%1\": %2")
.arg(compileCommandsFile.fileName(), compileCommandsFile.errorString()));
}
compileCommandsFile.write("[");

View File

@@ -116,7 +116,7 @@ ClangToolsOptionsPage::ClangToolsOptionsPage()
setId(Constants::SETTINGS_PAGE_ID);
setDisplayName(Tr::tr("Clang Tools"));
setCategory("T.Analyzer");
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
setDisplayCategory(QCoreApplication::translate("::Debugger", "Analyzer"));
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
setWidgetCreator([] { return new SettingsWidget; });
}

View File

@@ -246,7 +246,7 @@ bool CMakeBuildStep::init()
RunConfiguration *rc = target()->activeRunConfiguration();
if (!rc || rc->buildKey().isEmpty()) {
emit addTask(BuildSystemTask(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
QCoreApplication::translate("::ProjectExplorer",
"You asked to build the current Run Configuration's build target only, "
"but it is not associated with a build target. "
"Update the Make Step in your build settings.")));

View File

@@ -181,7 +181,7 @@ void CMakeProjectPlugin::initialize()
});
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::CMAKEFORMATTER_MENU_ID);
menu->menu()->setTitle(QCoreApplication::translate("CMakeFormatter", "CMakeFormatter"));
menu->menu()->setTitle(Tr::tr("CMakeFormatter"));
menu->setOnAllDisabledBehavior(Core::ActionContainer::Show);
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);

View File

@@ -126,7 +126,7 @@ CppcheckOptionsPage::CppcheckOptionsPage(CppcheckTool &tool, CppcheckTrigger &tr
setId(Constants::OPTIONS_PAGE_ID);
setDisplayName(Tr::tr("Cppcheck"));
setCategory("T.Analyzer");
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
setDisplayCategory(QCoreApplication::translate("::Debugger", "Analyzer"));
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
CppcheckOptions options;

View File

@@ -5077,7 +5077,7 @@ void GdbEngine::handleFetchVariables(const DebuggerResponse &response)
QString GdbEngine::msgPtraceError(DebuggerStartMode sm)
{
if (sm == StartInternal) {
return QCoreApplication::translate("QtDumperHelper",
return Tr::tr(
"ptrace: Operation not permitted.\n\n"
"Could not attach to the process. "
"Make sure no other debugger traces this process.\n"
@@ -5085,7 +5085,7 @@ QString GdbEngine::msgPtraceError(DebuggerStartMode sm)
"/proc/sys/kernel/yama/ptrace_scope\n"
"For more details, see /etc/sysctl.d/10-ptrace.conf\n");
}
return QCoreApplication::translate("QtDumperHelper",
return Tr::tr(
"ptrace: Operation not permitted.\n\n"
"Could not attach to the process. "
"Make sure no other debugger traces this process.\n"

View File

@@ -1079,7 +1079,7 @@ void QmlEnginePrivate::updateScriptSource(const QString &fileName, int lineOffse
}
//update open editors
QString titlePattern = QCoreApplication::translate("QmlEngine", "JS Source for %1").arg(fileName);
QString titlePattern = Tr::tr("JS Source for %1").arg(fileName);
//Check if there are open editors with the same title
const QList<IDocument *> documents = DocumentModel::openedDocuments();
for (IDocument *doc: documents) {
@@ -2044,7 +2044,7 @@ StackFrame QmlEnginePrivate::extractStackFrame(const QVariant &bodyVal)
stackFrame.function = extractString(body.value("func"));
if (stackFrame.function.isEmpty())
stackFrame.function = QCoreApplication::translate("QmlEngine", "Anonymous Function");
stackFrame.function = Tr::tr("Anonymous Function");
stackFrame.file = FilePath::fromString(
engine->toFileInProject(extractString(body.value("script"))));
stackFrame.usable = stackFrame.file.isReadableFile();

View File

@@ -46,7 +46,7 @@ bool FormPageFactory::validateData(Utils::Id typeId, const QVariant &data, QStri
{
QTC_ASSERT(canCreate(typeId), return false);
if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
*errorMessage = QCoreApplication::translate("::ProjectExplorer",
"\"data\" for a \"Form\" page needs to be unset or an empty object.");
return false;
}

View File

@@ -281,10 +281,8 @@ bool GerritServer::resolveRoot()
case CertificateError:
if (QMessageBox::question(
Core::ICore::dialogParent(),
QCoreApplication::translate(
"Gerrit::Internal::GerritDialog", "Certificate Error"),
QCoreApplication::translate(
"Gerrit::Internal::GerritDialog",
Tr::tr("Certificate Error"),
Tr::tr(
"Server certificate for %1 cannot be authenticated.\n"
"Do you want to disable SSL verification for this server?\n"
"Note: This can expose you to man-in-the-middle attack.")

View File

@@ -16,7 +16,7 @@ PerfOptionsPage::PerfOptionsPage(PerfSettings *settings)
setId(Constants::PerfSettingsId);
setDisplayName(Tr::tr("CPU Usage"));
setCategory("T.Analyzer");
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
setDisplayCategory(QCoreApplication::translate("::Debugger", "Analyzer"));
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
setWidgetCreator([settings] { return new PerfConfigWidget(settings); });
}

View File

@@ -4,6 +4,7 @@
#include "extraabi.h"
#include "abi.h"
#include "projectexplorertr.h"
#include <coreplugin/icore.h>
@@ -39,8 +40,7 @@ public:
};
AbiFlavorAccessor::AbiFlavorAccessor() :
UpgradingSettingsAccessor("QtCreatorExtraAbi",
QCoreApplication::translate("ProjectExplorer::ToolChainManager", "ABI"),
UpgradingSettingsAccessor("QtCreatorExtraAbi", Tr::tr("ABI")
Core::Constants::IDE_DISPLAY_NAME)
{
setBaseFilePath(Core::ICore::installerResourcePath("abi.xml"));

View File

@@ -3,6 +3,8 @@
#include "profilereader.h"
#include "qtsupporttr.h"
#include <coreplugin/icore.h>
#include <projectexplorer/taskhub.h>
@@ -26,7 +28,7 @@ ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
: m_verbose(verbose)
, m_exact(exact)
//: Prefix used for output from the cumulative evaluation of project files.
, m_prefix(QCoreApplication::translate("ProMessageHandler", "[Inexact] "))
, m_prefix(Tr::tr("[Inexact] "))
{
}

View File

@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "resourcenode.h"
#include "resourceeditorconstants.h"
#include "resourceeditortr.h"
#include "qrceditor/resourcefile_p.h"
#include <coreplugin/documentmanager.h>
@@ -433,9 +435,7 @@ bool ResourceTopLevelNode::removeNonExistingFiles()
FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const FilePaths &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(filePath().fileName())
.arg(QLatin1Char('/'));
const QString name = Tr::tr("%1 Prefix: %2").arg(filePath().fileName()).arg(QLatin1Char('/'));
int p = getPriorityFromContextNode(this, context);
if (p == -1 && hasPriority(files)) { // images/* and qml/js mimetypes
@@ -574,8 +574,7 @@ bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang
FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const FilePaths &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(m_topLevelNode->filePath().fileName())
const QString name = Tr::tr("%1 Prefix: %2").arg(m_topLevelNode->filePath().fileName())
.arg(displayName());
int p = getPriorityFromContextNode(this, context);