Skip to content

Commit 2401d0a

Browse files
committed
WebAPI: add translate to error messages
1 parent 4661abe commit 2401d0a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/webui/api/torrentscontroller.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,24 +1090,24 @@ namespace
10901090
QJsonParseError parseError;
10911091
const QJsonDocument doc = QJsonDocument::fromJson(rawJson.toUtf8(), &parseError);
10921092
if (parseError.error != QJsonParseError::NoError)
1093-
throw APIError(APIErrorType::BadParams, u"`stats` must be a JSON object: "_s + parseError.errorString());
1093+
throw APIError(APIErrorType::BadParams, QCoreApplication::translate("TorrentsController", "`stats` must be a JSON object: %1").arg(parseError.errorString()));
10941094
if (!doc.isObject())
1095-
throw APIError(APIErrorType::BadParams, u"`stats` must be a JSON object"_s);
1095+
throw APIError(APIErrorType::BadParams, QCoreApplication::translate("TorrentsController", "`stats` must be a JSON object"));
10961096

10971097
const QJsonObject obj = doc.object();
10981098

10991099
const auto readInt64 = [&obj](const QString &key) -> qint64
11001100
{
11011101
const QJsonValue v = obj.value(key);
11021102
if (v.isUndefined() || v.isNull())
1103-
throw APIError(APIErrorType::BadParams, u"`stats.%1` is required"_s.arg(key));
1103+
throw APIError(APIErrorType::BadParams, QCoreApplication::translate("TorrentsController", "`stats.%1` is required").arg(key));
11041104
return v.toVariant().toLongLong();
11051105
};
11061106
const auto readInt = [&obj](const QString &key) -> int
11071107
{
11081108
const QJsonValue v = obj.value(key);
11091109
if (v.isUndefined() || v.isNull())
1110-
throw APIError(APIErrorType::BadParams, u"`stats.%1` is required"_s.arg(key));
1110+
throw APIError(APIErrorType::BadParams, QCoreApplication::translate("TorrentsController", "`stats.%1` is required").arg(key));
11111111
return v.toVariant().toInt();
11121112
};
11131113

0 commit comments

Comments
 (0)