aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/translation/translation.cpp10
-rw-r--r--plugins/translation/translation.h4
2 files changed, 12 insertions, 2 deletions
diff --git a/plugins/translation/translation.cpp b/plugins/translation/translation.cpp
index 2b79fd4..47e3074 100644
--- a/plugins/translation/translation.cpp
+++ b/plugins/translation/translation.cpp
@@ -62,6 +62,11 @@ QString Translation::languageLocale() const
return m_languageLocale;
}
+QString Translation::emptyString() const
+{
+ return "";
+}
+
bool Translation::loadTranslationFile(const QString &langLocale)
{
QString fileToLoad(m_languageFilePath);
@@ -70,8 +75,9 @@ bool Translation::loadTranslationFile(const QString &langLocale)
if ( m_translator.load(fileToLoad) ) {
qApp->installTranslator(&m_translator);
- QEvent ev(QEvent::LanguageChange);
- qApp->sendEvent(QQmlEngine::contextForObject(this)->engine(), &ev);
+// NOTE: This only works with 5.10
+// QEvent ev(QEvent::LanguageChange);
+// qApp->sendEvent(QQmlEngine::contextForObject(this)->engine(), &ev);
return true;
}
diff --git a/plugins/translation/translation.h b/plugins/translation/translation.h
index c2e411b..2648f74 100644
--- a/plugins/translation/translation.h
+++ b/plugins/translation/translation.h
@@ -41,6 +41,7 @@ class Translation : public QObject
Q_OBJECT
Q_PROPERTY(QString languageLocale READ languageLocale WRITE setLanguageLocale NOTIFY languageLocaleChanged)
+ Q_PROPERTY(QString emptyString READ emptyString NOTIFY languageChanged)
public:
explicit Translation(QObject *parent = nullptr);
@@ -50,6 +51,9 @@ public:
void setLanguageLocale(const QString &languageLocale);
QString languageLocale() const;
+ // Helper method to notify string change
+ QString emptyString() const;
+
signals:
void languageLocaleChanged();
void languageChanged();