Loaded translation files correctly on MacOSX
This commit is contained in:
parent
7feb45b4ec
commit
bfee209b7a
2 changed files with 11 additions and 1 deletions
|
@ -108,7 +108,7 @@ IF (UPDATE_TRANSLATIONS)
|
||||||
ELSE (UPDATE_TRANSLATIONS)
|
ELSE (UPDATE_TRANSLATIONS)
|
||||||
IF (APPLE)
|
IF (APPLE)
|
||||||
SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES
|
SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES
|
||||||
OUTPUT_LOCATION ${CMAKE_BINARY_DIR}
|
OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/TelldusCenter.app/Contents/Resources
|
||||||
)
|
)
|
||||||
ELSEIF (UNIX)
|
ELSEIF (UNIX)
|
||||||
SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES
|
SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES
|
||||||
|
|
|
@ -1,13 +1,23 @@
|
||||||
#include "telldusgui.h"
|
#include "telldusgui.h"
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "devicewidget.h"
|
#include "devicewidget.h"
|
||||||
|
|
||||||
QWidget* WINAPI tdDeviceWidget( QWidget *parent ) {
|
QWidget* WINAPI tdDeviceWidget( QWidget *parent ) {
|
||||||
QTranslator *translator = new QTranslator(parent);
|
QTranslator *translator = new QTranslator(parent);
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QDir resDir = QDir(qApp->applicationDirPath());
|
||||||
|
if (resDir.dirName() == "MacOS") {
|
||||||
|
resDir.cdUp();
|
||||||
|
resDir.cd("resources");
|
||||||
|
}
|
||||||
|
translator->load("TelldusGui_" + QLocale::system().name(), resDir.absolutePath());
|
||||||
|
#else
|
||||||
translator->load("TelldusGui_" + QLocale::system().name());
|
translator->load("TelldusGui_" + QLocale::system().name());
|
||||||
|
#endif
|
||||||
qApp->installTranslator(translator);
|
qApp->installTranslator(translator);
|
||||||
return new DeviceWidget(parent);
|
return new DeviceWidget(parent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue