From 5173de57984dd5680ea1f3170530c552594904ae Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Fri, 16 Nov 2012 11:49:55 +0100 Subject: [PATCH] Theme: allow enforced locale --- src/mirall/application.cpp | 10 +++++++--- src/mirall/theme.h | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 742549d01..b42b34f05 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -96,15 +96,19 @@ Application::Application(int &argc, char **argv) : installTranslator(qtTranslator); QTranslator *mirallTranslator = new QTranslator(this); + + QString locale = Theme::instance()->enforcedLocale(); + if (locale.isEmpty()) locale = QLocale::system().name(); + #ifdef Q_OS_LINUX // FIXME - proper path! - mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), QLatin1String("/usr/share/mirall/i18n/")); + mirallTranslator->load(QLatin1String("mirall_") + locale, QLatin1String("/usr/share/mirall/i18n/")); #endif #ifdef Q_OS_MAC - mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir. + mirallTranslator->load(QLatin1String("mirall_") + locale, applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir. #endif #ifdef Q_OS_WIN32 - mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()); + mirallTranslator->load(QLatin1String("mirall_") + locale, applicationDirPath()); #endif installTranslator(mirallTranslator); diff --git a/src/mirall/theme.h b/src/mirall/theme.h index c210ff92f..01a07eac7 100644 --- a/src/mirall/theme.h +++ b/src/mirall/theme.h @@ -74,6 +74,12 @@ public: */ virtual QString defaultClientFolder() const; + /** + * Override to encforce a particular locale, i.e. "de" or "pt_BR" + */ + virtual QString enforcedLocale() const { return QString::null; } + + protected: QIcon themeIcon(const QString& name) const; Theme() {}