Mercurial > trustbridge
changeset 423:3d1e9df24803
Add translation loading
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 16 Apr 2014 17:11:18 +0000 |
parents | e2f6dd109a26 |
children | 81cf25402cb0 |
files | ui/main.cpp |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/main.cpp Wed Apr 16 17:06:45 2014 +0000 +++ b/ui/main.cpp Wed Apr 16 17:11:18 2014 +0000 @@ -12,6 +12,8 @@ #include <QtPlugin> #include <QMessageBox> #include <QSettings> +#include <QDebug> +#include <QTranslator> #ifndef VERSION #define VERSION "0.0.1" @@ -38,6 +40,17 @@ QStringList arguments = QApplication::arguments(); bool trayMode = arguments.contains("--tray"); + QTranslator translator; + if (QLocale::system().name() == "C") { + /* Useful for testing / development as the primary target is german */ + translator.load(":/l10n/trustbridge_de_DE"); + } else { + translator.load(":/l10n/trustbridge_" + QLocale::system().name()); + qDebug() << "Loading translations for: " << "trustbridge_" + + QLocale::system().name(); + } + app.installTranslator(&translator); + if (!QSystemTrayIcon::isSystemTrayAvailable() || !QSystemTrayIcon::supportsMessages()) { QMessageBox::critical(0, QString::fromLatin1(APPNAME),