fix: should install and use qm files
This commit is contained in:
parent
dbd576161a
commit
5c3523648e
|
@ -125,3 +125,17 @@ install (
|
||||||
TARGETS ${EXE_NAME}
|
TARGETS ${EXE_NAME}
|
||||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}/translations")
|
||||||
|
else ()
|
||||||
|
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/pineapple-music/translations")
|
||||||
|
target_compile_definitions(${EXE_NAME}
|
||||||
|
PRIVATE QM_FILE_INSTALL_DIR=${QM_FILE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
install (
|
||||||
|
FILES ${PMUSIC_QM_FILES}
|
||||||
|
DESTINATION ${QM_FILE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
|
@ -23,6 +23,26 @@
|
||||||
<source>Audio Files</source>
|
<source>Audio Files</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Pineapple Player</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>^</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>No song loaded...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Drag and drop file to load</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>0:00</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
|
|
12
main.cpp
12
main.cpp
|
@ -6,11 +6,23 @@
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QTranslator>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
QTranslator translator;
|
||||||
|
QString qmDir;
|
||||||
|
#ifdef _WIN32
|
||||||
|
qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
|
||||||
|
#else
|
||||||
|
qmDir = QT_STRINGIFY(QM_FILE_INSTALL_DIR);
|
||||||
|
#endif
|
||||||
|
translator.load(QString("pineapple-music_%1").arg(QLocale::system().name()), qmDir);
|
||||||
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
// parse commandline arguments
|
// parse commandline arguments
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.addPositionalArgument("File list", QCoreApplication::translate("main", "File list."));
|
parser.addPositionalArgument("File list", QCoreApplication::translate("main", "File list."));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user