Merge pull request #10027 from glassez/compile-ts

Compile translations at build time
This commit is contained in:
sledgehammer999
2018-12-31 11:31:45 +02:00
committed by GitHub
5 changed files with 24 additions and 55 deletions

View File

@@ -31,26 +31,6 @@ SOURCES += \
$$PWD/webapplication.cpp \
$$PWD/webui.cpp
RESOURCES += $$PWD/www/webui.qrc $$PWD/www/translations/webui_translations.qrc
TS_SOURCES += $$files($$PWD/www/translations/webui_*.ts)
# WebUI Translation
isEmpty(QMAKE_LRELEASE) {
win32: QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease.exe
else: QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
unix {
equals(QT_MAJOR_VERSION, 5) {
!exists($$QMAKE_LRELEASE): QMAKE_LRELEASE = lrelease-qt5
}
}
else {
!exists($$QMAKE_LRELEASE): QMAKE_LRELEASE = lrelease
}
}
WEBUI_TRANSLATIONS = $$files(www/translations/webui_*.ts)
WEBUI_TRANSLATIONS_NOEXT = $$replace(WEBUI_TRANSLATIONS, ".ts", "")
message("Building WebUI translations...")
for(L, WEBUI_TRANSLATIONS_NOEXT) {
message("Processing $${L}")
system("$$QMAKE_LRELEASE -silent $${L}.ts -qm $${L}.qm")
!exists("$${L}.qm"): error("Building WebUI translations failed, cannot continue!")
}
RESOURCES += $$PWD/www/webui.qrc $$PWD/www/translations/webui_translations.qrc