# HG changeset patch # User Andre Heinecke # Date 1397668278 0 # Node ID 3d1e9df2480368c9079bbb4cc43fab17e79f10ec # Parent e2f6dd109a26b7b76e6bb560a580ba062a8d9719 Add translation loading diff -r e2f6dd109a26 -r 3d1e9df24803 ui/main.cpp --- 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 #include #include +#include +#include #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),