File indexing completed on 2024-07-14 15:12:00

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqola_private_export.h"
0010 #include <QDebug>
0011 #include <QMap>
0012 class LIBRUQOLACORE_TESTS_EXPORT MessageTranslation
0013 {
0014 public:
0015     MessageTranslation();
0016     void parse(const QJsonObject &o);
0017     [[nodiscard]] bool operator==(const MessageTranslation &other) const;
0018 
0019     [[nodiscard]] QMap<QString, QString> translatedString() const;
0020     void setTranslatedString(const QMap<QString, QString> &translatedString);
0021 
0022     [[nodiscard]] QString translatedStringFromLanguage(const QString &lang);
0023 
0024     static QJsonArray serialize(const MessageTranslation &translation);
0025     static MessageTranslation deserialize(const QJsonArray &o);
0026 
0027     [[nodiscard]] bool isEmpty() const;
0028 
0029 private:
0030     QMap<QString, QString> mTranslatedString;
0031 };
0032 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const MessageTranslation &t);