mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Theme: allow enforced locale
This commit is contained in:
parent
6457153bda
commit
5173de5798
2 changed files with 13 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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() {}
|
||||
|
|
Loading…
Reference in a new issue