summaryrefslogtreecommitdiffstats
path: root/app/translator.h
blob: 82c5872b175f2ee1374c652aca06d5d898220e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef TRANSLATOR_H
#define TRANSLATOR_H

#include <QtCore/QObject>

class  QTranslator;

class Translator : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged)
public:
    explicit Translator(QObject *parent = nullptr);

    QString language() const;

    Q_INVOKABLE QString translate(const QString &string, const QString &language) const;
public slots:
    void setLanguage(const QString &language);

signals:
    void languageChanged(const QString &language);

private slots:
    void setTranslator(const QString &language);

private:
    QString m_language;
    QTranslator *m_translator;
};

#endif // TRANSLATOR_H