feat: i18n support again.
This commit is contained in:
parent
a6cfd1a714
commit
3a6a4cbc68
@ -121,6 +121,9 @@ if (WIN32)
|
||||
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}/translations")
|
||||
else ()
|
||||
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/pineapple-pictures/translations")
|
||||
target_compile_definitions(${EXE_NAME}
|
||||
PRIVATE QM_FILE_INSTALL_DIR=${QM_FILE_INSTALL_DIR}
|
||||
)
|
||||
endif ()
|
||||
|
||||
install (
|
||||
|
10
main.cpp
10
main.cpp
@ -1,6 +1,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDir>
|
||||
#include <QTranslator>
|
||||
#include <QUrl>
|
||||
|
||||
@ -8,9 +9,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
// since we did `CONFIG += lrelease embed_translations`...
|
||||
QTranslator translator;
|
||||
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), ":/i18n/");
|
||||
QString qmDir;
|
||||
#ifdef _WIN32
|
||||
qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
|
||||
#else
|
||||
qmDir = QString(QM_FILE_INSTALL_DIR);
|
||||
#endif
|
||||
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir);
|
||||
a.installTranslator(&translator);
|
||||
|
||||
// parse commandline arguments
|
||||
|
Loading…
Reference in New Issue
Block a user