summaryrefslogtreecommitdiffstats
path: root/app/translator.h
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-01-09 22:12:53 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2018-01-09 22:12:53 +0000
commit997ff3705532f62bd5b8948b2d00ffc1fffe6b7c (patch)
tree9f25bb4a64713bef08b020d090075c5f06cc7924 /app/translator.h
parentd084bc1f764833566f3e8eafc9fc297c3fa9ee08 (diff)
parent4b7d58e71e8864a90d3b567f21029968d6e8edef (diff)
Merge "Add basic translation support"
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