diff --git a/libguh-core/debugserverhandler.cpp b/libguh-core/debugserverhandler.cpp index c2ce494b..3ddb62f1 100644 --- a/libguh-core/debugserverhandler.cpp +++ b/libguh-core/debugserverhandler.cpp @@ -42,7 +42,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.setAutoFormatting(true); writer.writeStartDocument("1.0"); writer.writeProcessingInstruction("DOCUMENT", "html"); - writer.writeComment("Auto generated html page from nymea"); + writer.writeComment("Auto generated html page from nymea server"); writer.writeStartElement("html"); writer.writeAttribute("lang", GuhCore::instance()->configuration()->locale().name()); @@ -57,6 +57,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeAttribute("rel", "stylesheet"); writer.writeAttribute("href", "/debug/styles.css"); + //: The header title of the debug server interface writer.writeTextElement("title", QCoreApplication::translate("main", "Debug nymea")); writer.writeEndElement(); // head @@ -72,6 +73,8 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeEmptyElement("img"); writer.writeAttribute("src", "/debug/logo.svg"); writer.writeAttribute("class", "guh-main-logo"); + + //: The main title of the debug server interface writer.writeCharacters(QCoreApplication::translate("main", "nymea debug interface")); writer.writeEndElement(); // h1 writer.writeEndElement(); // div header @@ -80,6 +83,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "body"); + //: The welcome message of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Welcome to the debug interface.")); writer.writeTextElement("p", QCoreApplication::translate("main", "This debug interface was designed to provide an easy possibility to get helpful information about the running nymea server.")); @@ -96,7 +100,8 @@ QByteArray DebugServerHandler::createDebugXmlDocument() // Warning message writer.writeStartElement("div"); writer.writeAttribute("class", "warning-message"); - writer.writeCharacters(QCoreApplication::translate("main", "Be aware that this debug interface is a security breach and could offer access to sensible data.")); + //: The warning message of the debug interface + writer.writeCharacters(QCoreApplication::translate("main", "Be aware that this debug interface is a security risk and could offer access to sensible data.")); writer.writeEndElement(); // div warning message writer.writeEndElement(); // div warning @@ -104,27 +109,32 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeEmptyElement("hr"); // System information section + //: The server information section of the debug interface writer.writeTextElement("h2", QCoreApplication::translate("main", "Server information")); writer.writeEmptyElement("hr"); writer.writeStartElement("table"); writer.writeStartElement("tr"); + //: The user name in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "User")); writer.writeTextElement("td", qgetenv("USER")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The Qt build version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Compiled with Qt version")); writer.writeTextElement("td", QT_VERSION_STR); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The Qt runtime version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Qt runtime version")); writer.writeTextElement("td", qVersion()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The command description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Command")); writer.writeTextElement("td", QCoreApplication::arguments().join(' ')); writer.writeEndElement(); // tr @@ -133,31 +143,37 @@ QByteArray DebugServerHandler::createDebugXmlDocument() // Note: http://snapcraft.io/docs/reference/env writer.writeStartElement("tr"); + //: The snap name description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap name")); writer.writeTextElement("td", qgetenv("SNAP_NAME")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The snap version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap version")); writer.writeTextElement("td", qgetenv("SNAP_VERSION")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The snap directory description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap directory")); writer.writeTextElement("td", qgetenv("SNAP")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The snap application data description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap application data")); writer.writeTextElement("td", qgetenv("SNAP_DATA")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The snap user data description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap user data")); writer.writeTextElement("td", qgetenv("SNAP_USER_DATA")); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The snap common data description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Snap common data")); writer.writeTextElement("td", qgetenv("SNAP_COMMON")); writer.writeEndElement(); // tr @@ -165,46 +181,55 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("tr"); + //: The server name description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Server name")); writer.writeTextElement("td", GuhCore::instance()->configuration()->serverName()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The server version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Server version")); writer.writeTextElement("td", GUH_VERSION_STRING); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The API version description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "JSON-RPC version")); writer.writeTextElement("td", JSON_PROTOCOL_VERSION); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The language description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Language")); writer.writeTextElement("td", GuhCore::instance()->configuration()->locale().name() + " (" + GuhCore::instance()->configuration()->locale().nativeCountryName() + " - " + GuhCore::instance()->configuration()->locale().nativeLanguageName() + ")"); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The timezone description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Timezone")); writer.writeTextElement("td", QString::fromUtf8(GuhCore::instance()->configuration()->timeZone())); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The server id description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Server UUID")); writer.writeTextElement("td", GuhCore::instance()->configuration()->serverUuid().toString()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The settings path description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Settings path")); writer.writeTextElement("td", GuhSettings::settingsPath()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The translation path description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Translations path")); writer.writeTextElement("td", GuhSettings(GuhSettings::SettingsRoleGlobal).translationsPath()); writer.writeEndElement(); // tr writer.writeStartElement("tr"); + //: The log database path description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Log database")); writer.writeTextElement("td", GuhSettings(GuhSettings::SettingsRoleGlobal).logPath()); writer.writeEndElement(); // tr @@ -214,6 +239,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeEndElement(); // tr if (i == 0) { + //: The plugins path description in the server infromation section of the debug interface writer.writeTextElement("th", QCoreApplication::translate("main", "Plugin paths")); } else { writer.writeTextElement("th", ""); @@ -226,10 +252,12 @@ QByteArray DebugServerHandler::createDebugXmlDocument() // Downloads section writer.writeEmptyElement("hr"); + //: The downloads section of the debug interface writer.writeTextElement("h2", QCoreApplication::translate("main", "Downloads")); // Logs download section writer.writeEmptyElement("hr"); + //: The download logs section of the debug interface writer.writeTextElement("h3", QCoreApplication::translate("main", "Logs")); writer.writeEmptyElement("hr"); @@ -239,6 +267,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The log databse download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Log database")); writer.writeEndElement(); // div download-name-column @@ -256,6 +285,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("button"); writer.writeAttribute("class", "button"); writer.writeAttribute("type", "submit"); + //: The download button description of the debug interface writer.writeCharacters(QCoreApplication::translate("main", "Download")); writer.writeEndElement(); // button writer.writeEndElement(); // form @@ -270,6 +300,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The syslog download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "System logs")); writer.writeEndElement(); // div download-name-column @@ -297,6 +328,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() // Settings download section writer.writeEmptyElement("hr"); + //: The settings download section title of the debug interface writer.writeTextElement("h3", QCoreApplication::translate("main", "Settings")); writer.writeEmptyElement("hr"); @@ -306,6 +338,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The guhd settings download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Guhd settings")); writer.writeEndElement(); // div download-name-column @@ -337,6 +370,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The device settings download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Device settings")); writer.writeEndElement(); // div download-name-column @@ -368,6 +402,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The device states settings download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Device states settings")); writer.writeEndElement(); // div download-name-column @@ -399,6 +434,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The rules settings download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Rules settings")); writer.writeEndElement(); // div download-name-column @@ -430,6 +466,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "download-name-column"); + //: The plugins settings download description of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Plugins settings")); writer.writeEndElement(); // div download-name-column @@ -461,6 +498,7 @@ QByteArray DebugServerHandler::createDebugXmlDocument() writer.writeStartElement("div"); writer.writeAttribute("class", "footer"); writer.writeTextElement("p", QString("Copyright %1 2018 guh GmbH.").arg(QChar(0xA9))); + //: The footer license note of the debug interface writer.writeTextElement("p", QCoreApplication::translate("main", "Released under the GNU GENERAL PUBLIC LICENSE Version 2.")); writer.writeEndElement(); // div footer @@ -504,7 +542,8 @@ QByteArray DebugServerHandler::createErrorXmlDocument(HttpReply::HttpStatusCode writer.writeStartElement("div"); writer.writeAttribute("class", "header"); writer.writeTextElement("p", " "); - writer.writeTextElement("h1", QCoreApplication::translate("main", "Error") + QString(" %1").arg(static_cast(statusCode))); + //: The HTTP error message of the debug interface. The %1 represents the error code ie.e 404 + writer.writeTextElement("h1", QCoreApplication::translate("main", "Error %1").arg(static_cast(statusCode))); writer.writeEndElement(); // div header // Body @@ -610,7 +649,8 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read log database file for debug download" << GuhSettings::logPath() << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + logDatabaseFile.fileName())); + //: The HTTP error message of the debug interface. The %1 represents the file name. + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(logDatabaseFile.fileName()))); return reply; } @@ -618,7 +658,8 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read log database file for debug download" << GuhSettings::logPath(); HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + logDatabaseFile.fileName())); + //: The HTTP error message of the debug interface. The %1 represents the file name. + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(logDatabaseFile.fileName()))); return reply; } @@ -641,7 +682,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read log database file for debug download" << syslogFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + syslogFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(syslogFileName))); return reply; } @@ -649,7 +690,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read syslog file for debug download" << syslogFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + syslogFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(syslogFileName))); return reply; } @@ -672,7 +713,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(settingsFileName))); return reply; } @@ -680,7 +721,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(settingsFileName))); return reply; } @@ -701,7 +742,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(settingsFileName))); return reply; } @@ -709,7 +750,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(settingsFileName))); return reply; } @@ -730,7 +771,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(settingsFileName))); return reply; } @@ -738,7 +779,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(settingsFileName))); return reply; } @@ -759,7 +800,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(settingsFileName))); return reply; } @@ -767,7 +808,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(settingsFileName))); return reply; } @@ -788,7 +829,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName << "file does not exist."; HttpReply *reply = RestResource::createErrorReply(HttpReply::NotFound); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not find file \"%1\".").arg(settingsFileName))); return reply; } @@ -796,7 +837,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath) qCWarning(dcWebServer()) << "Could not read file for debug download" << settingsFileName; HttpReply *reply = RestResource::createErrorReply(HttpReply::Forbidden); reply->setHeader(HttpReply::ContentTypeHeader, "text/html"); - reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file") + " " + settingsFileName)); + reply->setPayload(createErrorXmlDocument(HttpReply::NotFound, QCoreApplication::translate("main", "Could not open file \"%1\".").arg(settingsFileName))); return reply; }