forked from qt-creator/qt-creator
WebAssembly: Convert to using Tr::tr
Change-Id: I7fb420363884236ebd7eeb589a29a475f8911915 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -52186,7 +52186,7 @@ What do you want to do?</source>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebAssembly::Internal::EmrunRunConfigurationFactory</name>
|
||||
<name>WebAssembly</name>
|
||||
<message>
|
||||
<source>Effective emrun call:</source>
|
||||
<translation>Команда запуска emrun:</translation>
|
||||
@@ -52195,9 +52195,6 @@ What do you want to do?</source>
|
||||
<source>Launch with emrun</source>
|
||||
<translation>Запустить через emrun</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebAssembly::Internal::WebAssemblyDevice</name>
|
||||
<message>
|
||||
<source>Web Browser</source>
|
||||
<translation>Браузер</translation>
|
||||
@@ -52206,9 +52203,6 @@ What do you want to do?</source>
|
||||
<source>WebAssembly Runtime</source>
|
||||
<translation>Среда WebAssembly</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebAssembly::Internal::WebAssemblyToolChain</name>
|
||||
<message>
|
||||
<source>Emscripten Compiler</source>
|
||||
<translation>Компилятор Emscripten</translation>
|
||||
@@ -52217,9 +52211,6 @@ What do you want to do?</source>
|
||||
<source>WebAssembly</source>
|
||||
<translation>WebAssembly</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebAssembly::Internal::WebBrowserSelectionAspect</name>
|
||||
<message>
|
||||
<source>Web browser</source>
|
||||
<translation>Браузер</translation>
|
||||
@@ -52228,9 +52219,6 @@ What do you want to do?</source>
|
||||
<source>Web browser:</source>
|
||||
<translation>Браузер:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WebAssemblyPlugin</name>
|
||||
<message>
|
||||
<source>WebAssembly</source>
|
||||
<comment>Qt Version is meant for WebAssembly</comment>
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "webassemblyconstants.h"
|
||||
#include "webassemblydevice.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
||||
@@ -16,7 +17,7 @@ WebAssemblyDevice::WebAssemblyDevice()
|
||||
{
|
||||
setupId(IDevice::AutoDetected, Constants::WEBASSEMBLY_DEVICE_DEVICE_ID);
|
||||
setType(Constants::WEBASSEMBLY_DEVICE_TYPE);
|
||||
const QString displayNameAndType = tr("Web Browser");
|
||||
const QString displayNameAndType = Tr::tr("Web Browser");
|
||||
setDefaultDisplayName(displayNameAndType);
|
||||
setDisplayType(displayNameAndType);
|
||||
setDeviceState(IDevice::DeviceStateUnknown);
|
||||
@@ -26,13 +27,13 @@ WebAssemblyDevice::WebAssemblyDevice()
|
||||
|
||||
IDevice::Ptr WebAssemblyDevice::create()
|
||||
{
|
||||
return IDevice::Ptr(new WebAssemblyDevice);
|
||||
return IDevicePtr(new WebAssemblyDevice);
|
||||
}
|
||||
|
||||
WebAssemblyDeviceFactory::WebAssemblyDeviceFactory()
|
||||
: ProjectExplorer::IDeviceFactory(Constants::WEBASSEMBLY_DEVICE_TYPE)
|
||||
{
|
||||
setDisplayName(WebAssemblyDevice::tr("WebAssembly Runtime"));
|
||||
setDisplayName(Tr::tr("WebAssembly Runtime"));
|
||||
setCombinedIcon(":/webassembly/images/webassemblydevicesmall.png",
|
||||
":/webassembly/images/webassemblydevice.png");
|
||||
setConstructionFunction(&WebAssemblyDevice::create);
|
||||
|
@@ -10,8 +10,6 @@ namespace Internal {
|
||||
|
||||
class WebAssemblyDevice final : public ProjectExplorer::DesktopDevice
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::WebAssemblyDevice)
|
||||
|
||||
public:
|
||||
static ProjectExplorer::IDevice::Ptr create();
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "webassemblyoptionspage.h"
|
||||
#include "webassemblyqtversion.h"
|
||||
#include "webassemblytoolchain.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/environment.h>
|
||||
@@ -24,8 +25,6 @@ namespace Internal {
|
||||
|
||||
class WebAssemblyOptionsWidget : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::WebAssemblyOptionsWidget)
|
||||
|
||||
public:
|
||||
WebAssemblyOptionsWidget();
|
||||
|
||||
@@ -47,18 +46,16 @@ WebAssemblyOptionsWidget::WebAssemblyOptionsWidget()
|
||||
auto mainLayout = new QVBoxLayout(this);
|
||||
|
||||
{
|
||||
auto pathChooserBox = new QGroupBox(tr("Emscripten SDK path:"));
|
||||
auto pathChooserBox = new QGroupBox(Tr::tr("Emscripten SDK path:"));
|
||||
pathChooserBox->setFlat(true);
|
||||
auto layout = new QVBoxLayout(pathChooserBox);
|
||||
auto instruction = new QLabel(
|
||||
tr("Select the root directory of an "
|
||||
"<a href=\"https://emscripten.org/docs/getting_started/downloads.html\">"
|
||||
"installed Emscripten SDK</a>. Ensure that the activated SDK version is "
|
||||
"compatible with the "
|
||||
"<a href=\"https://doc.qt.io/qt-5/wasm.html#install-emscripten\">Qt 5</a> "
|
||||
"or "
|
||||
"<a href=\"https://doc.qt.io/qt-6/wasm.html#install-emscripten\">Qt 6</a> "
|
||||
"version that you plan to develop against."));
|
||||
Tr::tr("Select the root directory of an installed %1. "
|
||||
"Ensure that the activated SDK version is compatible with the %2 "
|
||||
"or %3 version that you plan to develop against.")
|
||||
.arg(R"(<a href="https://emscripten.org/docs/getting_started/downloads.html">Emscripten SDK</a>)")
|
||||
.arg(R"(<a href="https://doc.qt.io/qt-5/wasm.html#install-emscripten">Qt 5</a>)")
|
||||
.arg(R"(<a href="https://doc.qt.io/qt-6/wasm.html#install-emscripten">Qt 6</a>)"));
|
||||
|
||||
instruction->setOpenExternalLinks(true);
|
||||
instruction->setWordWrap(true);
|
||||
@@ -78,7 +75,7 @@ WebAssemblyOptionsWidget::WebAssemblyOptionsWidget()
|
||||
}
|
||||
|
||||
{
|
||||
m_emSdkEnvGroupBox = new QGroupBox(tr("Emscripten SDK environment:"));
|
||||
m_emSdkEnvGroupBox = new QGroupBox(Tr::tr("Emscripten SDK environment:"));
|
||||
m_emSdkEnvGroupBox->setFlat(true);
|
||||
m_emSdkEnvGroupBox->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);
|
||||
auto layout = new QVBoxLayout(m_emSdkEnvGroupBox);
|
||||
@@ -95,8 +92,8 @@ WebAssemblyOptionsWidget::WebAssemblyOptionsWidget()
|
||||
const QString minimumSupportedQtVersion =
|
||||
WebAssemblyQtVersion::minimumSupportedQtVersion().toString();
|
||||
m_qtVersionDisplay = new InfoLabel(
|
||||
tr("Note: %1 supports Qt %2 for WebAssembly and higher. "
|
||||
"Your installed lower version(s) are not supported.")
|
||||
Tr::tr("Note: %1 supports Qt %2 for WebAssembly and higher. "
|
||||
"Your installed lower Qt version(s) are not supported.")
|
||||
.arg(Core::ICore::versionString(), minimumSupportedQtVersion),
|
||||
InfoLabel::Warning);
|
||||
m_qtVersionDisplay->setElideMode(Qt::ElideNone);
|
||||
@@ -110,9 +107,10 @@ static QString environmentDisplay(const FilePath &sdkRoot)
|
||||
Environment env;
|
||||
WebAssemblyEmSdk::addToEnvironment(sdkRoot, env);
|
||||
QString result;
|
||||
result.append(WebAssemblyOptionsWidget::tr("<h4>Adding directories to PATH:</h4>"));
|
||||
auto h4 = [](const QString &text) { return QString("<h4>" + text + "</h4>"); };
|
||||
result.append(h4(Tr::tr("Adding directories to PATH:")));
|
||||
result.append(env.value("PATH").replace(OsSpecificAspects::pathListSeparator(sdkRoot.osType()), "<br/>"));
|
||||
result.append(WebAssemblyOptionsWidget::tr("<h4>Setting environment variables:</h4>"));
|
||||
result.append(h4(Tr::tr("Setting environment variables:")));
|
||||
for (const QString &envVar : env.toStringList()) {
|
||||
if (!envVar.startsWith("PATH")) // Path was already printed out above
|
||||
result.append(envVar + "<br/>");
|
||||
@@ -135,12 +133,15 @@ void WebAssemblyOptionsWidget::updateStatus()
|
||||
const QVersionNumber minVersion = WebAssemblyToolChain::minimumSupportedEmSdkVersion();
|
||||
const bool versionTooLow = sdkVersion < minVersion;
|
||||
m_emSdkVersionDisplay->setType(versionTooLow ? InfoLabel::NotOk : InfoLabel::Ok);
|
||||
auto bold = [](const QString &text) { return QString("<b>" + text + "</b>"); };
|
||||
m_emSdkVersionDisplay->setText(
|
||||
versionTooLow ? tr("The activated version <b>%1</b> is not supported by %2."
|
||||
"<br/>Activate version <b>%3</b> or higher.")
|
||||
.arg(sdkVersion.toString(), Core::ICore::versionString(),
|
||||
minVersion.toString())
|
||||
: tr("Activated version: <b>%1</b>").arg(sdkVersion.toString()));
|
||||
versionTooLow ? Tr::tr("The activated version %1 is not supported by %2. "
|
||||
"Activate version %3 or higher.")
|
||||
.arg(bold(sdkVersion.toString()))
|
||||
.arg(bold(Core::ICore::versionString()))
|
||||
.arg(bold(minVersion.toString()))
|
||||
: Tr::tr("Activated version: %1")
|
||||
.arg(bold(sdkVersion.toString())));
|
||||
m_emSdkEnvDisplay->setText(environmentDisplay(sdkPath));
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ void WebAssemblyOptionsWidget::apply()
|
||||
WebAssemblyOptionsPage::WebAssemblyOptionsPage()
|
||||
{
|
||||
setId(Id(Constants::SETTINGS_ID));
|
||||
setDisplayName(WebAssemblyOptionsWidget::tr("WebAssembly"));
|
||||
setDisplayName(Tr::tr("WebAssembly"));
|
||||
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
||||
setWidgetCreator([] { return new WebAssemblyOptionsWidget; });
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "webassemblyplugin.h"
|
||||
#include "webassemblyconstants.h"
|
||||
#include "webassemblydevice.h"
|
||||
#include "webassemblyoptionspage.h"
|
||||
#include "webassemblyplugin.h"
|
||||
#include "webassemblyqtversion.h"
|
||||
#include "webassemblyrunconfiguration.h"
|
||||
#include "webassemblytoolchain.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
@@ -83,10 +84,10 @@ void WebAssemblyPlugin::askUserAboutEmSdkSetup()
|
||||
return;
|
||||
|
||||
InfoBarEntry info(setupWebAssemblyEmSdk,
|
||||
tr("Setup Emscripten SDK for WebAssembly? "
|
||||
Tr::tr("Setup Emscripten SDK for WebAssembly? "
|
||||
"To do it later, select Edit > Preferences > Devices > WebAssembly."),
|
||||
InfoBarEntry::GlobalSuppression::Enabled);
|
||||
info.addCustomButton(tr("Setup Emscripten SDK"), [setupWebAssemblyEmSdk] {
|
||||
info.addCustomButton(Tr::tr("Setup Emscripten SDK"), [setupWebAssemblyEmSdk] {
|
||||
ICore::infoBar()->removeInfo(setupWebAssemblyEmSdk);
|
||||
QTimer::singleShot(0, []() { ICore::showOptionsDialog(Constants::SETTINGS_ID); });
|
||||
});
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "webassemblyconstants.h"
|
||||
#include "webassemblyqtversion.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -29,8 +30,7 @@ WebAssemblyQtVersion::WebAssemblyQtVersion() = default;
|
||||
|
||||
QString WebAssemblyQtVersion::description() const
|
||||
{
|
||||
return QCoreApplication::translate("WebAssemblyPlugin", "WebAssembly",
|
||||
"Qt Version is meant for WebAssembly");
|
||||
return Tr::tr("WebAssembly", "Qt Version is meant for WebAssembly");
|
||||
}
|
||||
|
||||
QSet<Id> WebAssemblyQtVersion::targetDeviceTypes() const
|
||||
@@ -59,7 +59,7 @@ QString WebAssemblyQtVersion::invalidReason() const
|
||||
if (!baseReason.isEmpty())
|
||||
return baseReason;
|
||||
|
||||
return tr("%1 does not support Qt for WebAssembly below version %2.")
|
||||
return Tr::tr("%1 does not support Qt for WebAssembly below version %2.")
|
||||
.arg(Core::ICore::versionString())
|
||||
.arg(minimumSupportedQtVersion().toString());
|
||||
}
|
||||
|
@@ -11,8 +11,6 @@ namespace Internal {
|
||||
|
||||
class WebAssemblyQtVersion : public QtSupport::QtVersion
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::WebAssemblyQtVersion)
|
||||
|
||||
public:
|
||||
WebAssemblyQtVersion();
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "webassemblyrunconfigurationaspects.h"
|
||||
#include "webassemblyrunconfiguration.h"
|
||||
#include "webassemblyconstants.h"
|
||||
#include "webassemblyrunconfiguration.h"
|
||||
#include "webassemblyrunconfigurationaspects.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
auto webBrowserAspect = addAspect<WebBrowserSelectionAspect>(target);
|
||||
|
||||
auto effectiveEmrunCall = addAspect<StringAspect>();
|
||||
effectiveEmrunCall->setLabelText(EmrunRunConfigurationFactory::tr("Effective emrun call:"));
|
||||
effectiveEmrunCall->setLabelText(Tr::tr("Effective emrun call:"));
|
||||
effectiveEmrunCall->setDisplayStyle(StringAspect::TextEditDisplay);
|
||||
effectiveEmrunCall->setReadOnly(true);
|
||||
|
||||
|
@@ -11,8 +11,6 @@ namespace Internal {
|
||||
|
||||
class EmrunRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::EmrunRunConfigurationFactory)
|
||||
|
||||
public:
|
||||
EmrunRunConfigurationFactory();
|
||||
};
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "webassemblyrunconfigurationaspects.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
@@ -41,7 +42,8 @@ static WebBrowserEntries parseEmrunOutput(const QByteArray &output)
|
||||
|
||||
static WebBrowserEntries emrunBrowsers(ProjectExplorer::Target *target)
|
||||
{
|
||||
WebBrowserEntries result{{{}, WebBrowserSelectionAspect::tr("Default Browser")}};
|
||||
WebBrowserEntries result;
|
||||
result.append(qMakePair(QString(), Tr::tr("Default Browser")));
|
||||
if (auto bc = target->activeBuildConfiguration()) {
|
||||
const Utils::Environment environment = bc->environment();
|
||||
const Utils::FilePath emrunPath = environment.searchInPath("emrun");
|
||||
@@ -64,7 +66,7 @@ WebBrowserSelectionAspect::WebBrowserSelectionAspect(ProjectExplorer::Target *ta
|
||||
const int defaultIndex = qBound(0, m_availableBrowsers.count() - 1, 1);
|
||||
m_currentBrowser = m_availableBrowsers.at(defaultIndex).first;
|
||||
}
|
||||
setDisplayName(tr("Web Browser"));
|
||||
setDisplayName(Tr::tr("Web Browser"));
|
||||
setId("WebBrowserAspect");
|
||||
setSettingsKey("RunConfiguration.WebBrowser");
|
||||
|
||||
@@ -82,7 +84,7 @@ void WebBrowserSelectionAspect::addToLayout(LayoutBuilder &builder)
|
||||
m_currentBrowser = m_webBrowserComboBox->currentData().toString();
|
||||
emit changed();
|
||||
});
|
||||
builder.addItems({tr("Web browser:"), m_webBrowserComboBox});
|
||||
builder.addItems({Tr::tr("Web browser:"), m_webBrowserComboBox});
|
||||
}
|
||||
|
||||
void WebBrowserSelectionAspect::fromMap(const QVariantMap &map)
|
||||
|
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "webassemblytoolchain.h"
|
||||
#include "webassemblyconstants.h"
|
||||
#include "webassemblyemsdk.h"
|
||||
#include "webassemblytoolchain.h"
|
||||
#include "webassemblytr.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
@@ -58,7 +59,7 @@ WebAssemblyToolChain::WebAssemblyToolChain() :
|
||||
{
|
||||
setSupportedAbis({toolChainAbi()});
|
||||
setTargetAbi(toolChainAbi());
|
||||
setTypeDisplayName(tr("Emscripten Compiler"));
|
||||
setTypeDisplayName(Tr::tr("Emscripten Compiler"));
|
||||
}
|
||||
|
||||
FilePath WebAssemblyToolChain::makeCommand(const Environment &environment) const
|
||||
@@ -117,7 +118,7 @@ static Toolchains doAutoDetect(const ToolchainDetector &detector)
|
||||
const FilePath scriptFile = sdk.withNewPath(script).searchInDirectories(env.path());
|
||||
toolChain->setCompilerCommand(scriptFile);
|
||||
|
||||
const QString displayName = WebAssemblyToolChain::tr("Emscripten Compiler %1 for %2")
|
||||
const QString displayName = Tr::tr("Emscripten Compiler %1 for %2")
|
||||
.arg(toolChain->version(), QLatin1String(cLanguage ? "C" : "C++"));
|
||||
toolChain->setDisplayName(displayName);
|
||||
result.append(toolChain);
|
||||
@@ -159,7 +160,7 @@ bool WebAssemblyToolChain::areToolChainsRegistered()
|
||||
|
||||
WebAssemblyToolChainFactory::WebAssemblyToolChainFactory()
|
||||
{
|
||||
setDisplayName(WebAssemblyToolChain::tr("Emscripten"));
|
||||
setDisplayName(Tr::tr("Emscripten"));
|
||||
setSupportedToolChainType(Constants::WEBASSEMBLY_TOOLCHAIN_TYPEID);
|
||||
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
|
||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
||||
|
@@ -12,8 +12,6 @@ namespace Internal {
|
||||
|
||||
class WebAssemblyToolChain final : public ProjectExplorer::GccToolChain
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::WebAssemblyToolChain)
|
||||
|
||||
public:
|
||||
WebAssemblyToolChain();
|
||||
|
||||
|
Reference in New Issue
Block a user