summaryrefslogtreecommitdiffstats
path: root/app/translator.h
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-04-05 16:25:31 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2019-04-10 09:30:15 +0900
commit008e2c6e164d5ec5b93d68ba649ca1d9c8f28079 (patch)
treed8ed4442448a4c20c5d5610b05ddbd8377fa0e0f /app/translator.h
Add demo3 dashboard source code. [Patch Set 2] Update LICENSE file. BUG-AGL: SPEC-2261 Change-Id: Iccd58c03317dfe961fac2f42a8d719d4e70bbfcd Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'app/translator.h')
-rw-r--r--app/translator.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/translator.h b/app/translator.h
new file mode 100644
index 0000000..82c5872
--- /dev/null
+++ b/app/translator.h
@@ -0,0 +1,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