From 5b18ece1f6db6995c961a3d74667b3fbc7a68d45 Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Tue, 5 Dec 2023 22:14:47 +0100 Subject: [PATCH] translating the prefix in warnings and errors --- src/utils/common/MsgHandler.cpp | 4 ++++ src/utils/common/MsgHandler.h | 32 ++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/utils/common/MsgHandler.cpp b/src/utils/common/MsgHandler.cpp index cb58efa7f222..f1f90c4b0189 100644 --- a/src/utils/common/MsgHandler.cpp +++ b/src/utils/common/MsgHandler.cpp @@ -54,6 +54,8 @@ bool MsgHandler::myWriteDebugMessages = false; bool MsgHandler::myWriteDebugGLMessages = false; bool MsgHandler::myWriteTimestamps = false; bool MsgHandler::myWriteProcessId = false; +std::string MsgHandler::myErrorPrefix = "Error: "; +std::string MsgHandler::myWarningPrefix = "Warning: "; // =========================================================================== @@ -305,6 +307,8 @@ MsgHandler::setupI18n(const std::string& locale) { #else UNUSED_PARAMETER(locale); #endif + myWarningPrefix = TL("Warning: "); + myErrorPrefix = TL("Error: "); } diff --git a/src/utils/common/MsgHandler.h b/src/utils/common/MsgHandler.h index c631b0e43cb6..13950f39a1c1 100644 --- a/src/utils/common/MsgHandler.h +++ b/src/utils/common/MsgHandler.h @@ -186,10 +186,10 @@ class MsgHandler { case MsgType::MT_MESSAGE: break; case MsgType::MT_WARNING: - prefix += "Warning: "; + prefix += myWarningPrefix; break; case MsgType::MT_ERROR: - prefix += "Error: "; + prefix += myErrorPrefix; break; case MsgType::MT_DEBUG: prefix += "Debug: "; @@ -259,21 +259,33 @@ class MsgHandler { /// @brief storage for initial messages std::vector myInitialMessages; -private: - /// @brief invalid copy constructor - MsgHandler(const MsgHandler& s) = delete; - - /// @brief invalid assignment operator - MsgHandler& operator=(const MsgHandler& s) = delete; - - /** @brief Flag to enable or disable debug GL Functions + /** @brief Flag to enable or disable debug output * * This value is used to show more internal information through warning messages about certain operations */ static bool myWriteDebugMessages; + + /// @brief Flag to enable or disable GL specific debug output static bool myWriteDebugGLMessages; + + /// @brief Whether to prefix every message with a time stamp static bool myWriteTimestamps; + + /// @brief Whether to prefix every message with the process id static bool myWriteProcessId; + + /// @brief The possibly translated error prefix (mainly for speedup) + static std::string myErrorPrefix; + + /// @brief The possibly translated warning prefix (mainly for speedup) + static std::string myWarningPrefix; + +private: + /// @brief invalid copy constructor + MsgHandler(const MsgHandler& s) = delete; + + /// @brief invalid assignment operator + MsgHandler& operator=(const MsgHandler& s) = delete; };