[build] Tweaked .qm file generation

This commit is contained in:
Slava Monich 2021-08-06 04:06:17 +03:00
parent c5f338d145
commit a952d3daa4

View file

@ -252,6 +252,7 @@ equals(PREFIX, "openrepos") {
} }
# Translations # Translations
TRANSLATION_IDBASED=-idbased
TRANSLATION_SOURCES = \ TRANSLATION_SOURCES = \
$${_PRO_FILE_PWD_}/qml \ $${_PRO_FILE_PWD_}/qml \
$${_PRO_FILE_PWD_}/settings $${_PRO_FILE_PWD_}/settings
@ -259,33 +260,33 @@ TRANSLATION_SOURCES = \
defineTest(addTrFile) { defineTest(addTrFile) {
rel = translations/harbour-$${1} rel = translations/harbour-$${1}
OTHER_FILES += $${rel}.ts OTHER_FILES += $${rel}.ts
export(OTHER_FILES)
in = $${_PRO_FILE_PWD_}/$$rel in = $${_PRO_FILE_PWD_}/$${rel}
out = $${OUT_PWD}/translations/$${PREFIX}-$$1 out = $${OUT_PWD}/translations/$${PREFIX}-$${1}
s = $$replace(1,-,_) s = $$replace(1,-,_)
lupdate_target = lupdate_$$s lupdate_target = lupdate_$$s
lrelease_target = lrelease_$$s qm_target = qm_$$s
$${lupdate_target}.commands = lupdate -noobsolete $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \ $${lupdate_target}.commands = lupdate -noobsolete -locations none $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \
mkdir -p \"$${OUT_PWD}/translations\" && [ \"$${in}.ts\" != \"$${out}.ts\" ] && \ mkdir -p \"$${OUT_PWD}/translations\" && [ \"$${in}.ts\" != \"$${out}.ts\" ] && \
cp -af \"$${in}.ts\" \"$${out}.ts\" || : cp -af \"$${in}.ts\" \"$${out}.ts\" || :
$${lrelease_target}.target = $${out}.qm $${qm_target}.path = $$TRANSLATIONS_PATH
$${lrelease_target}.depends = $${lupdate_target} $${qm_target}.depends = $${lupdate_target}
$${lrelease_target}.commands = lrelease -idbased \"$${out}.ts\" $${qm_target}.commands = lrelease $$TRANSLATION_IDBASED \"$${out}.ts\" && \
$(INSTALL_FILE) \"$${out}.qm\" $(INSTALL_ROOT)$${TRANSLATIONS_PATH}/
QMAKE_EXTRA_TARGETS += $${lupdate_target} $${qm_target}
INSTALLS += $${qm_target}
QMAKE_EXTRA_TARGETS += $${lrelease_target} $${lupdate_target}
PRE_TARGETDEPS += $${out}.qm
qm.files += $${out}.qm
export($${lupdate_target}.commands) export($${lupdate_target}.commands)
export($${lrelease_target}.target) export($${qm_target}.path)
export($${lrelease_target}.depends) export($${qm_target}.depends)
export($${lrelease_target}.commands) export($${qm_target}.commands)
export(QMAKE_EXTRA_TARGETS) export(QMAKE_EXTRA_TARGETS)
export(PRE_TARGETDEPS) export(INSTALLS)
export(OTHER_FILES)
export(qm.files)
} }
LANGUAGES = de fi hu nl pl pt ru sv es zh_CN LANGUAGES = de fi hu nl pl pt ru sv es zh_CN
@ -294,7 +295,3 @@ addTrFile($${NAME})
for(l, LANGUAGES) { for(l, LANGUAGES) {
addTrFile($${NAME}-$$l) addTrFile($${NAME}-$$l)
} }
qm.path = $$TRANSLATIONS_PATH
qm.CONFIG += no_check_exist
INSTALLS += qm