| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | // Qt-Security score:significant reason:header-decls-only |
| 4 | |
| 5 | #ifndef QTRANSLATOR_H |
| 6 | #define QTRANSLATOR_H |
| 7 | |
| 8 | #include <QtCore/qobject.h> |
| 9 | #include <QtCore/qbytearray.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | |
| 14 | #ifndef QT_NO_TRANSLATION |
| 15 | |
| 16 | class QLocale; |
| 17 | class QTranslatorPrivate; |
| 18 | |
| 19 | class Q_CORE_EXPORT QTranslator : public QObject |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | public: |
| 23 | explicit QTranslator(QObject *parent = nullptr); |
| 24 | ~QTranslator(); |
| 25 | |
| 26 | virtual QString translate(const char *context, const char *sourceText, |
| 27 | const char *disambiguation = nullptr, int n = -1) const; |
| 28 | |
| 29 | virtual bool isEmpty() const; |
| 30 | |
| 31 | QString language() const; |
| 32 | QString filePath() const; |
| 33 | |
| 34 | [[nodiscard]] bool load(const QString & filename, |
| 35 | const QString & directory = QString(), |
| 36 | const QString & search_delimiters = QString(), |
| 37 | const QString & suffix = QString()); |
| 38 | [[nodiscard]] bool load(const QLocale & locale, |
| 39 | const QString & filename, |
| 40 | const QString & prefix = QString(), |
| 41 | const QString & directory = QString(), |
| 42 | const QString & suffix = QString()); |
| 43 | [[nodiscard]] bool load(const uchar *data, int len, |
| 44 | const QString &directory = QString()); |
| 45 | |
| 46 | private: |
| 47 | Q_DISABLE_COPY(QTranslator) |
| 48 | Q_DECLARE_PRIVATE(QTranslator) |
| 49 | }; |
| 50 | |
| 51 | #endif // QT_NO_TRANSLATION |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif // QTRANSLATOR_H |
| 56 | |