Browse Source

Allow to translate error messages

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
2c23840947
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/session.cpp
  2. 8
      src/base/rss/rss_session.cpp
  3. 2
      src/webui/api/apierror.h
  4. 4
      src/webui/api/searchcontroller.cpp

4
src/base/bittorrent/session.cpp

@ -4220,8 +4220,8 @@ void Session::startUpTorrents() @@ -4220,8 +4220,8 @@ void Session::startUpTorrents()
}
if (numOfRemappedFiles > 0) {
LogMsg(QString(tr("Queue positions were corrected in %1 resume files"))
.arg(numOfRemappedFiles), Log::CRITICAL);
LogMsg(tr("Queue positions were corrected in %1 resume files").arg(numOfRemappedFiles)
, Log::CRITICAL);
}
// starting up downloading torrents (queue position > 0)

8
src/base/rss/rss_session.cpp

@ -296,7 +296,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -296,7 +296,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
const QJsonObject valObj {val.toObject()};
if (valObj.contains("url")) {
if (!valObj["url"].isString()) {
LogMsg(QString("Couldn't load RSS Feed '%1'. URL is required.")
LogMsg(tr("Couldn't load RSS Feed '%1'. URL is required.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
continue;
}
@ -305,13 +305,13 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -305,13 +305,13 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
if (valObj.contains("uid")) {
uid = QUuid {valObj["uid"].toString()};
if (uid.isNull()) {
LogMsg(QString("Couldn't load RSS Feed '%1'. UID is invalid.")
LogMsg(tr("Couldn't load RSS Feed '%1'. UID is invalid.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
continue;
}
if (m_feedsByUID.contains(uid)) {
LogMsg(QString("Duplicate RSS Feed UID: %1. Configuration seems to be corrupted.")
LogMsg(tr("Duplicate RSS Feed UID: %1. Configuration seems to be corrupted.")
.arg(uid.toString()), Log::WARNING);
continue;
}
@ -329,7 +329,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) @@ -329,7 +329,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder)
}
}
else {
LogMsg(QString("Couldn't load RSS Item '%1'. Invalid data format.")
LogMsg(tr("Couldn't load RSS Item '%1'. Invalid data format.")
.arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING);
}
}

2
src/webui/api/apierror.h

@ -42,7 +42,7 @@ enum class APIErrorType @@ -42,7 +42,7 @@ enum class APIErrorType
class APIError : public RuntimeError
{
public:
explicit APIError(APIErrorType type, const QString &message = "");
explicit APIError(APIErrorType type, const QString &message = {});
APIErrorType type() const;

4
src/webui/api/searchcontroller.cpp

@ -66,7 +66,7 @@ void SearchController::startAction() @@ -66,7 +66,7 @@ void SearchController::startAction()
requireParams({"pattern", "category", "plugins"});
if (!Utils::ForeignApps::pythonInfo().isValid())
throw APIError(APIErrorType::Conflict, "Python must be installed to use the Search Engine.");
throw APIError(APIErrorType::Conflict, tr("Python must be installed to use the Search Engine."));
const QString pattern = params()["pattern"].trimmed();
const QString category = params()["category"].trimmed();
@ -89,7 +89,7 @@ void SearchController::startAction() @@ -89,7 +89,7 @@ void SearchController::startAction()
ISession *const session = sessionManager()->session();
auto activeSearches = session->getData<QSet<int>>(ACTIVE_SEARCHES);
if (activeSearches.size() >= MAX_CONCURRENT_SEARCHES)
throw APIError(APIErrorType::Conflict, QString("Unable to create more than %1 concurrent searches.").arg(MAX_CONCURRENT_SEARCHES));
throw APIError(APIErrorType::Conflict, tr("Unable to create more than %1 concurrent searches.").arg(MAX_CONCURRENT_SEARCHES));
const auto id = generateSearchId();
const SearchHandlerPtr searchHandler {SearchPluginManager::instance()->startSearch(pattern, category, pluginsToUse)};

Loading…
Cancel
Save