mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
Fix translations update for qt5.13
This commit is contained in:
parent
0344ec2103
commit
c5979ac481
1 changed files with 18 additions and 14 deletions
|
|
@ -11,28 +11,37 @@ set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)
|
|||
|
||||
# Build languages resource file.
|
||||
set(TS_FILES)
|
||||
set(I18N_CONTENT "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n <qresource prefix=\"/\">\n")
|
||||
foreach (lang ${LANGUAGES})
|
||||
list(APPEND TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.ts")
|
||||
set(QM_FILES)
|
||||
set(QM_FILES_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
set(I18N_CONTENT "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n <qresource>\n")
|
||||
foreach (lang ${LANGUAGES})
|
||||
# Note: the below `languages/` path is not the same as the `${LANGUAGES_DIRECTORY}` value.
|
||||
# It's the symbolic path used by the linphone binary in the qrc model.
|
||||
# This path is used in `app.cpp`.
|
||||
set(I18N_CONTENT "${I18N_CONTENT} <file alias=\"languages/${lang}\">${lang}.qm</file>\n")
|
||||
endforeach ()
|
||||
|
||||
#Clean existing generated file
|
||||
file(REMOVE "${QM_FILES_OUTPUT_DIR}/${lang}.qm")
|
||||
#Force re-interpretation of ts files
|
||||
file(TOUCH "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.ts")
|
||||
|
||||
list(APPEND TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.ts")
|
||||
endforeach()
|
||||
set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n")
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${I18N_FILENAME}" "${I18N_CONTENT}")
|
||||
|
||||
# Create `qm` files from `ts` files.
|
||||
qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES} OPTIONS -no-obsolete)
|
||||
|
||||
# Workaround: Create empty files for some cmake versions. Otherwise, the qm rules can't be used.
|
||||
foreach (qm ${QM_FILES})
|
||||
if (NOT EXISTS "${qm}")
|
||||
file(GENERATE OUTPUT "${qm}" CONTENT "")
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#qt5 macro: creates or updates ts files from translation routines from all sources files (h,cpp,qml)
|
||||
#Then creates `qm` files from `ts` files which are referenced by the i18n qrc files
|
||||
qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES} OPTIONS -no-obsolete)
|
||||
|
||||
# Update translations.
|
||||
add_custom_target(update_translations
|
||||
|
|
@ -43,8 +52,3 @@ add_custom_target(update_translations
|
|||
|
||||
# Remove `*.qm` when `clean` is called.
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${QM_FILES}")
|
||||
|
||||
# Command to just remove `.qm` files.
|
||||
add_custom_target(remove_qm_files
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${QM_FILES}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue