actually load the translation

This commit is contained in:
Mathias Panzenböck
2014-02-24 01:32:56 +01:00
parent 6bd58aeb7c
commit 2cf16c698b
4 changed files with 13 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#define QJOYPAD_ICON24 "@CMAKE_INSTALL_PREFIX@/share/icons/hicolor/24x24/apps/qjoypad.png"
#define QJOYPAD_ICON64 "@CMAKE_INSTALL_PREFIX@/share/icons/hicolor/64x64/apps/qjoypad.png"
#define QJOYPAD_L10N_DIR "@CMAKE_INSTALL_PREFIX@/share/qjoypad/translations/"
#cmakedefine WITH_LIBUDEV

View File

@ -10,6 +10,7 @@
#include <QSystemTrayIcon>
#include <QPointer>
#include <QFileInfo>
#include <QTranslator>
//to load layouts
#include "layout.h"
@ -48,8 +49,16 @@ int main( int argc, char **argv )
//create a new event loop. This will be captured by the QApplication
//when it gets created
QApplication app( argc, argv );
QTranslator translator;
app.setQuitOnLastWindowClosed(false);
if (translator.load(QLocale::system(), "qjoypad", "_", QJOYPAD_L10N_DIR)) {
app.installTranslator(&translator);
}
else {
debug_mesg("no translation for locale: %s\n", qPrintable(QLocale::system().name()));
}
//where QJoyPad saves its settings!
const QString settingsDir(QDir::homePath() + "/.qjoypad3/");