comparison ui/main.cpp @ 423:3d1e9df24803

Add translation loading
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 16 Apr 2014 17:11:18 +0000
parents 09bb19e5e369
children 0f4331ed4e83
comparison
equal deleted inserted replaced
422:e2f6dd109a26 423:3d1e9df24803
10 #include <QApplication> 10 #include <QApplication>
11 #include <QSystemTrayIcon> 11 #include <QSystemTrayIcon>
12 #include <QtPlugin> 12 #include <QtPlugin>
13 #include <QMessageBox> 13 #include <QMessageBox>
14 #include <QSettings> 14 #include <QSettings>
15 #include <QDebug>
16 #include <QTranslator>
15 17
16 #ifndef VERSION 18 #ifndef VERSION
17 #define VERSION "0.0.1" 19 #define VERSION "0.0.1"
18 #endif 20 #endif
19 21
36 QApplication app (argc, argv); 38 QApplication app (argc, argv);
37 39
38 QStringList arguments = QApplication::arguments(); 40 QStringList arguments = QApplication::arguments();
39 bool trayMode = arguments.contains("--tray"); 41 bool trayMode = arguments.contains("--tray");
40 42
43 QTranslator translator;
44 if (QLocale::system().name() == "C") {
45 /* Useful for testing / development as the primary target is german */
46 translator.load(":/l10n/trustbridge_de_DE");
47 } else {
48 translator.load(":/l10n/trustbridge_" + QLocale::system().name());
49 qDebug() << "Loading translations for: " << "trustbridge_" +
50 QLocale::system().name();
51 }
52 app.installTranslator(&translator);
53
41 if (!QSystemTrayIcon::isSystemTrayAvailable() || 54 if (!QSystemTrayIcon::isSystemTrayAvailable() ||
42 !QSystemTrayIcon::supportsMessages()) { 55 !QSystemTrayIcon::supportsMessages()) {
43 QMessageBox::critical(0, QString::fromLatin1(APPNAME), 56 QMessageBox::critical(0, QString::fromLatin1(APPNAME),
44 QObject::tr("Couldn't detect any system tray " 57 QObject::tr("Couldn't detect any system tray "
45 "on this system. This software can only " 58 "on this system. This software can only "

http://wald.intevation.org/projects/trustbridge/