diff options
author | Tasuku Suzuki <tasuku.suzuki@qt.io> | 2017-11-20 17:19:14 +0900 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2017-11-30 09:10:14 +0000 |
commit | e26dac76bc82ba7888726cc0b2eb5103b50ef17e (patch) | |
tree | 36ae0d5c88fe512354705958edb1ae48750a1968 /app/translator.h | |
parent | 242e1fa5c7a5d670e0014fdae7973546984b521d (diff) |
I18N: add basic functionality and a few translations
Added very first i18n support in the simple application.
Placed language buttons at the bottom to change current language.
They should be removed once current language comes from somewhere.
Laying out issues should be fixed later.
Change-Id: Ib5d646784820cb2753edd5a588a8826ad7d20539
Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
(cherry picked from commit 464e6c7f6056cec8a1d150216338d58a827307e6)
Diffstat (limited to 'app/translator.h')
-rw-r--r-- | app/translator.h | 32 |
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 |