Mercurial > trustbridge
comparison ui/administrator.cpp @ 420:16b6d5686835
Switch to resource based loading of translations
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 16 Apr 2014 17:00:59 +0000 |
parents | 09bb19e5e369 |
children | 280f2556a48b |
comparison
equal
deleted
inserted
replaced
411:413b29f6758f | 420:16b6d5686835 |
---|---|
9 | 9 |
10 #include <QApplication> | 10 #include <QApplication> |
11 #include <QtPlugin> | 11 #include <QtPlugin> |
12 #include <QMessageBox> | 12 #include <QMessageBox> |
13 #include <QSettings> | 13 #include <QSettings> |
14 #include <QTranslator> | |
15 #include <QDebug> | |
14 | 16 |
15 #ifndef VERSION | 17 #ifndef VERSION |
16 #define VERSION "0.0.1" | 18 #define VERSION "0.0.1" |
17 #endif | 19 #endif |
18 | 20 |
39 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); | 41 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); |
40 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); | 42 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); |
41 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); | 43 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); |
42 QSettings::setDefaultFormat(QSettings::IniFormat); | 44 QSettings::setDefaultFormat(QSettings::IniFormat); |
43 | 45 |
46 QTranslator translator; | |
47 if (QLocale::system().name() == "C") { | |
48 /* Useful for testing / development as the primary target is german */ | |
49 translator.load(":/l10n/administrator_de_DE"); | |
50 } else { | |
51 translator.load(":/l10n/administrator_" + QLocale::system().name()); | |
52 qDebug() << "Loading translations for: " << "administrator_" + | |
53 QLocale::system().name(); | |
54 } | |
55 app.installTranslator(&translator); | |
56 | |
44 AdministratorWindow adminWin; | 57 AdministratorWindow adminWin; |
45 adminWin.show(); | 58 adminWin.show(); |
46 | 59 |
47 return app.exec(); | 60 return app.exec(); |
48 } | 61 } |