#include "Helper.h" // Case 1: namespace as prefix template<> void Utils::Helper::fromJson(const QJsonValue &json, bool &value) { if (json.isBool()) { value = json.toBool(); } else { // Warning: "tr() cannot be called without context" --> lupdate fails to add string to .ts file QString msg = tr("Failed to convert value to bool."); } } // Case 2: explicit namespace declaration namespace Utils { template<> void Helper::fromJson(const QJsonValue &json, double &value) { if (json.isDouble()) { value = json.toDouble(); } else { // Warning: "Class 'Utils' lacks Q_OBJECT macro" --> Translation in wrong context 'Utils' QString msg = tr("Failed to convert value to double."); } } } // namespace Utils