Extensions: Edit UI text

- Add dots to ends of messages
- Replace "plugin" with "extension" in translatable text
- Fix capitalization of headings and button labels
- Change wording

Change-Id: I24a3ca6de6a5a0a4509bab34ad2f50cbcf40c73a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Leena Miettinen
2024-06-25 10:34:55 +02:00
parent d6eee1e250
commit a81e4fb277
5 changed files with 37 additions and 36 deletions

View File

@@ -279,8 +279,8 @@ public:
: QWidget(parent)
{
m_label = new InfoLabel;
m_checkBox = new QCheckBox(Tr::tr("Load on Start"));
m_restartButton = new Button(Tr::tr("Restart now"), Button::MediumPrimary);
m_checkBox = new QCheckBox(Tr::tr("Load on start"));
m_restartButton = new Button(Tr::tr("Restart Now"), Button::MediumPrimary);
m_restartButton->setVisible(false);
m_pluginView.hide();
@@ -667,9 +667,9 @@ void ExtensionManagerWidget::fetchAndInstallPlugin(const QUrl &url)
struct StorageStruct
{
StorageStruct() {
progressDialog.reset(new QProgressDialog(Tr::tr("Downloading Plugin..."),
Tr::tr("Cancel"), 0, 0,
ICore::dialogParent()));
progressDialog.reset(new QProgressDialog(
Tr::tr("Downloading..."), Tr::tr("Cancel"), 0, 0, ICore::dialogParent()));
progressDialog->setWindowTitle(Tr::tr("Download Extension"));
progressDialog->setWindowModality(Qt::ApplicationModal);
progressDialog->setFixedSize(progressDialog->sizeHint());
progressDialog->setAutoClose(false);
@@ -694,7 +694,7 @@ void ExtensionManagerWidget::fetchAndInstallPlugin(const QUrl &url)
QMessageBox::warning(
ICore::dialogParent(),
Tr::tr("Download Error"),
Tr::tr("Could not download Plugin") + "\n\n" + storage->url.toString() + "\n\n"
Tr::tr("Cannot download extension") + "\n\n" + storage->url.toString() + "\n\n"
+ Tr::tr("Code: %1.").arg(query.reply()->error()));
}
};

View File

@@ -59,7 +59,7 @@ void addFetchModule()
LuaOptionsPage(Module *module)
{
setId("BB.Lua.Fetch");
setDisplayName(Tr::tr("Network access"));
setDisplayName(Tr::tr("Network Access"));
setCategory("ZY.Lua");
setDisplayCategory("Lua");
setCategoryIconPath(":/lua/images/settingscategory_lua.png");
@@ -176,8 +176,8 @@ void addFetchModule()
// so we have to use a QMessageBox instead of the info bar
auto msgBox = new QMessageBox(
QMessageBox::Question,
Tr::tr("Allow Internet access"),
Tr::tr("The plugin \"%1\" would like to fetch from the following url:\n%2")
Tr::tr("Allow Internet Access"),
Tr::tr("Allow the extension \"%1\" to fetch from the following URL:\n%2")
.arg(pluginName)
.arg(url),
QMessageBox::Yes | QMessageBox::No,
@@ -205,14 +205,13 @@ void addFetchModule()
Utils::InfoBarEntry entry{
Utils::Id::fromString("Fetch" + pluginName),
Tr::tr("The plugin \"%1\" would like to fetch data from the internet. Do "
"you want to allow this?")
Tr::tr("Allow the extension \"%1\" to fetch data from the internet?")
.arg(pluginName)};
entry.setDetailsWidgetCreator([pluginName, url] {
const QString markdown = Tr::tr("The plugin \"**%1**\" would like to fetch "
"from the following url:\n\n")
.arg(pluginName)
+ QString("* [%3](%3)").arg(url);
const QString markdown = Tr::tr("Allow the extension \"%1\" to fetch data"
"from the following URL:\n\n")
.arg("**" + pluginName + "**")
+ QString("* [%1](%1)").arg(url);
QLabel *list = new QLabel();
list->setTextFormat(Qt::TextFormat::MarkdownText);
@@ -225,7 +224,7 @@ void addFetchModule()
Core::ICore::infoBar()->removeInfo(Utils::Id::fromString("Fetch" + pluginName));
fetch();
});
entry.addCustomButton(Tr::tr("Allow once"), [pluginName, fetch]() {
entry.addCustomButton(Tr::tr("Allow Once"), [pluginName, fetch]() {
Core::ICore::infoBar()->removeInfo(Utils::Id::fromString("Fetch" + pluginName));
fetch();
});
@@ -311,8 +310,8 @@ void addFetchModule()
};
checkPermission(url, actualFetch, [callback, pluginName]() {
callback(Tr::tr("Fetching is not allowed for the plugin \"%1\" (You can edit "
"permissions in Preferences => Lua)")
callback(Tr::tr("Fetching is not allowed for the extension \"%1\". (You can edit "
"permissions in Preferences > Lua.)")
.arg(pluginName));
});
};

View File

@@ -50,7 +50,7 @@ expected_str<QJsonDocument> getPackageInfo(const FilePath &appDataPath)
return make_unexpected(error.errorString());
if (!doc.isObject())
return make_unexpected(Tr::tr("Package info is not an object"));
return make_unexpected(Tr::tr("Package info is not an object."));
return doc;
}
@@ -66,7 +66,7 @@ expected_str<QJsonObject> getInstalledPackageInfo(const FilePath &appDataPath, c
if (root.contains(name)) {
QJsonValue v = root[name];
if (!v.isObject())
return make_unexpected(Tr::tr("Installed package info is not an object"));
return make_unexpected(Tr::tr("Installed package info is not an object."));
return v.toObject();
}
@@ -86,12 +86,12 @@ expected_str<QJsonDocument> getOrCreatePackageInfo(const FilePath &appDataPath)
expected_str<void> savePackageInfo(const FilePath &appDataPath, const QJsonDocument &doc)
{
if (!appDataPath.ensureWritableDir())
return make_unexpected(Tr::tr("Could not create app data directory"));
return make_unexpected(Tr::tr("Cannot create app data directory."));
const FilePath packageInfoPath = appDataPath / "package.json";
return packageInfoPath.writeFileContents(doc.toJson())
.transform_error([](const QString &error) {
return Tr::tr("Could not write to package info: %1").arg(error);
return Tr::tr("Cannot write to package info: %1").arg(error);
})
.transform([](qint64) { return; });
}
@@ -147,7 +147,7 @@ static Group installRecipe(
const auto size = reply->size();
const auto written = storage->write(reply->readAll());
if (written != size)
return emitResult(Tr::tr("Could not write to temporary file"));
return emitResult(Tr::tr("Cannot write to temporary file."));
storage->close();
return DoneResult::Success;
};
@@ -169,7 +169,7 @@ static Group installRecipe(
const auto onUnarchiverDone = [appDataPath, installOptionsIt, emitResult](DoneWith result) {
if (result == DoneWith::Error)
return emitResult(Tr::tr("Unarchiving failed"));
return emitResult(Tr::tr("Unarchiving failed."));
if (result == DoneWith::Cancel)
return DoneResult::Error;
@@ -212,7 +212,7 @@ static Group installRecipe(
}
if (!storage->open(QIODevice::WriteOnly)) {
emitResult(Tr::tr("Could not open temporary file"));
emitResult(Tr::tr("Cannot open temporary file."));
return SetupResult::StopWithError;
}
return SetupResult::Continue;
@@ -326,16 +326,17 @@ void addInstallModule()
if (QApplication::activeModalWidget()) {
auto msgBox = new QMessageBox(
QMessageBox::Question,
Tr::tr("Install package"),
Tr::tr("Install Package"),
msg,
QMessageBox::Yes | QMessageBox::No,
Core::ICore::dialogParent());
const QString details
= Tr::tr("The plugin \"%1\" would like to install the following "
= Tr::tr("The extension \"%1\" wants to install the following "
"package(s):\n\n")
.arg(pluginSpec->name)
+ Utils::transform(installOptionsList, [](const InstallOptions &options) {
//: %1 = package name, %2 = version, %3 = URL
return QString("* %1 - %2 (from: %3)")
.arg(options.name, options.version, options.url.toString());
}).join("\n");
@@ -363,11 +364,12 @@ void addInstallModule()
entry.setCancelButtonInfo(denied);
const QString details
= Tr::tr("The plugin \"**%1**\" would like to install the following "
= Tr::tr("The extension \"%1\" wants to install the following "
"package(s):\n\n")
.arg(pluginSpec->name)
.arg("**" + pluginSpec->name + "**") // markdown bold
+ Utils::transform(installOptionsList, [](const InstallOptions &options) {
return QString("* %1 - %2 (from: [%3](%3))")
//: Markdown list item: %1 = package name, %2 = version, %3 = URL
return Tr::tr("* %1 - %2 (from: [%3](%3))")
.arg(options.name, options.version, options.url.toString());
}).join("\n");

View File

@@ -164,7 +164,7 @@ expected_str<void> LuaEngine::connectHooks(
QString hookName = QStringList{path, k.as<QString>()}.join(".");
auto it = d->m_hooks.find(hookName);
if (it == d->m_hooks.end())
return make_unexpected(QString("No hook named '%1' found").arg(hookName));
return make_unexpected(Tr::tr("No hook with the name \"%1\" found.").arg(hookName));
else
it.value()(v.as<sol::function>());
}
@@ -265,7 +265,7 @@ expected_str<sol::protected_function> LuaEngine::prepareSetup(
auto pluginTable = result.get<sol::optional<sol::table>>();
if (!pluginTable)
return make_unexpected(Tr::tr("Script did not return a table"));
return make_unexpected(Tr::tr("Script did not return a table."));
auto hookTable = pluginTable->get<sol::optional<sol::table>>("hooks");
@@ -278,7 +278,7 @@ expected_str<sol::protected_function> LuaEngine::prepareSetup(
auto setupFunction = pluginTable->get_or<sol::function>("setup", {});
if (!setupFunction)
return make_unexpected(Tr::tr("Plugin info table did not contain a setup function"));
return make_unexpected(Tr::tr("Extension info table did not contain a setup function."));
return setupFunction;
}

View File

@@ -108,19 +108,19 @@ bool LuaPluginSpec::initializePlugin()
= LuaEngine::instance().prepareSetup(*activeLuaState, *this);
if (!setupResult) {
setError(Lua::Tr::tr("Failed to prepare plugin setup: %1").arg(setupResult.error()));
setError(Lua::Tr::tr("Cannot prepare extension setup: %1").arg(setupResult.error()));
return false;
}
auto result = setupResult->call();
if (result.get_type() == sol::type::boolean && result.get<bool>() == false) {
setError(Lua::Tr::tr("Plugin setup function returned false"));
setError(Lua::Tr::tr("Extension setup function returned false."));
return false;
} else if (result.get_type() == sol::type::string) {
std::string error = result.get<sol::error>().what();
if (!error.empty()) {
setError(Lua::Tr::tr("Plugin setup function returned error: %1")
setError(Lua::Tr::tr("Extension setup function returned error: %1")
.arg(QString::fromStdString(error)));
return false;
}