Avoid duplicate resources and ensure generic Qt UI l10n loaded

This commit is contained in:
Bill Somerville 2020-05-31 14:41:59 +01:00
parent 51f18b1faa
commit 1371b71c5a
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -1094,7 +1094,7 @@ add_custom_target (ctags COMMAND ${CTAGS} -o ${CMAKE_SOURCE_DIR}/tags -R ${sourc
add_custom_target (etags COMMAND ${ETAGS} -o ${CMAKE_SOURCE_DIR}/TAGS -R ${sources}) add_custom_target (etags COMMAND ${ETAGS} -o ${CMAKE_SOURCE_DIR}/TAGS -R ${sources})
# Qt i18n # Qt i18n - always include the country generic if any regional variant is included
set (LANGUAGES set (LANGUAGES
en # English (we need this to stop en # English (we need this to stop
# translation loaders loading the # translation loaders loading the
@ -1108,13 +1108,11 @@ set (LANGUAGES
zh_HK # Chinese per Hong Kong zh_HK # Chinese per Hong Kong
) )
foreach (lang_ ${LANGUAGES}) foreach (lang_ ${LANGUAGES})
file (TO_NATIVE_PATH translations/wsjtx_${lang_}.ts ts_) file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/translations/wsjtx_${lang_}.ts ts_)
list (APPEND TS_FILES ${ts_}) if (EXISTS "${ts_}")
set (qt_translations_ "${QT_TRANSLATIONS_DIR}/qtbase_${lang_}.qm") list (APPEND TS_FILES ${ts_})
if (NOT EXISTS "${qt_translations_}")
string (REGEX REPLACE "([a-z][a-z])_[A-Z][A-Z]" "\\1" lang_ ${lang_})
set (qt_translations_ "${QT_TRANSLATIONS_DIR}/qtbase_${lang_}.qm")
endif () endif ()
set (qt_translations_ "${QT_TRANSLATIONS_DIR}/qtbase_${lang_}.qm")
if (EXISTS "${qt_translations_}") if (EXISTS "${qt_translations_}")
add_custom_command ( add_custom_command (
OUTPUT "${CMAKE_BINARY_DIR}/qt_${lang_}.qm" OUTPUT "${CMAKE_BINARY_DIR}/qt_${lang_}.qm"