also update TS files via CMake

This commit is contained in:
Martchus 2016-04-24 20:53:14 +02:00
parent 0b68468814
commit 10726b4dee
2 changed files with 8 additions and 3 deletions

View File

@ -17,7 +17,12 @@ if(TS_FILES)
find_package(Qt5LinguistTools REQUIRED)
# adds the translations and a target for it
qt5_add_translation(QM_FILES ${TS_FILES})
qt5_create_translation(QM_FILES
${HEADER_FILES} ${SRC_FILES}
${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_UI_FILES}
${QML_HEADER_FILES} ${QML_SRC_FILES} ${QML_RES_FILES}
${TS_FILES}
)
add_custom_target(${META_PROJECT_NAME}_translations ALL DEPENDS ${QM_FILES})
# add installs and install target for translations

View File

@ -111,9 +111,9 @@ void loadApplicationTranslationFile(const QString &applicationName, const QStrin
{
QTranslator *appTranslator = new QTranslator;
QString fileName = QStringLiteral("%1_%2").arg(applicationName, localeName);
if(appTranslator->load(fileName, QStringLiteral("./translations"))) {
if(appTranslator->load(fileName, QStringLiteral("."))) {
QCoreApplication::installTranslator(appTranslator);
} else if(appTranslator->load(fileName, QStringLiteral("./projects/%1/translations").arg(applicationName))) {
} else if(appTranslator->load(fileName, QStringLiteral("./translations"))) {
QCoreApplication::installTranslator(appTranslator);
} else if(appTranslator->load(fileName, QStringLiteral("/usr/share/%1/translations").arg(applicationName))) {
QCoreApplication::installTranslator(appTranslator);