Browse Source
Qt translations have to be compiled in a shared library or executable, and since we use static libraries for the components, webui translation files have to be compiled into the main executable.adaptive-webui-19844
Eugene Shalygin
6 years ago
6 changed files with 111 additions and 69 deletions
@ -0,0 +1,48 @@ |
|||||||
|
# macros to handle translation files |
||||||
|
|
||||||
|
# qbt_add_translations(<target> QRC_FILE <filename> TS_FILES <filenames>) |
||||||
|
# handles out of source builds for Qt resource files that include translations |
||||||
|
# The function generates translations out of the supplied list of .ts files in the build directory, |
||||||
|
# copies the .qrc file there, calls qt5_add_resources() adds its output to the target sources list. |
||||||
|
function(qbt_add_translations _target) |
||||||
|
set(oneValueArgs QRC_FILE) |
||||||
|
set(multiValueArgs TS_FILES) |
||||||
|
cmake_parse_arguments(QBT_TR "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
||||||
|
|
||||||
|
get_target_property(_binaryDir ${_target} BINARY_DIR) |
||||||
|
|
||||||
|
if (NOT QBT_TR_QRC_FILE) |
||||||
|
message(FATAL_ERROR "QRC file is empty") |
||||||
|
endif() |
||||||
|
if (NOT QBT_TR_TS_FILES) |
||||||
|
message(FATAL_ERROR "TS_FILES files are empty") |
||||||
|
endif() |
||||||
|
|
||||||
|
if(IS_ABSOLUTE "${QBT_TR_QRC_FILE}") |
||||||
|
file(RELATIVE_PATH _qrcToTs "${CMAKE_CURRENT_SOURCE_DIR}" "${QBT_TR_QRC_FILE}") |
||||||
|
else() |
||||||
|
set(_qrcToTs "${QBT_TR_QRC_FILE}") |
||||||
|
endif() |
||||||
|
|
||||||
|
get_filename_component(_qrcToTsDir "${_qrcToTs}" DIRECTORY) |
||||||
|
|
||||||
|
get_filename_component(_qmFilesBinaryDir "${CMAKE_CURRENT_BINARY_DIR}/${_qrcToTsDir}" ABSOLUTE) |
||||||
|
# to make qt5_add_translation() work as we need |
||||||
|
set_source_files_properties(${QBT_TR_TS_FILES} PROPERTIES OUTPUT_LOCATION "${_qmFilesBinaryDir}") |
||||||
|
qt5_add_translation(_qmFiles ${QBT_TR_TS_FILES}) |
||||||
|
|
||||||
|
set(_qrc_dest_dir "${_binaryDir}/${_qrcToTsDir}") |
||||||
|
set(_qrc_dest_file "${_binaryDir}/${QBT_TR_QRC_FILE}") |
||||||
|
|
||||||
|
message(STATUS "copying ${QBT_TR_QRC_FILE} to ${_qrc_dest_dir}") |
||||||
|
file(COPY ${QBT_TR_QRC_FILE} DESTINATION ${_qrc_dest_dir}) |
||||||
|
|
||||||
|
set_source_files_properties("${_qrc_dest_file}" PROPERTIES |
||||||
|
GENERATED True |
||||||
|
OBJECT_DEPENDS "${_qmFiles}") |
||||||
|
|
||||||
|
# With AUTORCC enabled rcc is ran by cmake before language files are generated, |
||||||
|
# and thus we call rcc explicitly |
||||||
|
qt5_add_resources(_resources "${_qrc_dest_file}") |
||||||
|
target_sources(${_target} PRIVATE "${_resources}") |
||||||
|
endfunction() |
@ -0,0 +1,54 @@ |
|||||||
|
<RCC> |
||||||
|
<qresource prefix="/www/translations"> |
||||||
|
<file>webui_ar.qm</file> |
||||||
|
<file>webui_be.qm</file> |
||||||
|
<file>webui_bg.qm</file> |
||||||
|
<file>webui_ca.qm</file> |
||||||
|
<file>webui_cs.qm</file> |
||||||
|
<file>webui_da.qm</file> |
||||||
|
<file>webui_de.qm</file> |
||||||
|
<file>webui_el.qm</file> |
||||||
|
<file>webui_en.qm</file> |
||||||
|
<file>webui_en_AU.qm</file> |
||||||
|
<file>webui_en_GB.qm</file> |
||||||
|
<file>webui_eo.qm</file> |
||||||
|
<file>webui_es.qm</file> |
||||||
|
<file>webui_eu.qm</file> |
||||||
|
<file>webui_fi.qm</file> |
||||||
|
<file>webui_fr.qm</file> |
||||||
|
<file>webui_gl.qm</file> |
||||||
|
<file>webui_he.qm</file> |
||||||
|
<file>webui_hi_IN.qm</file> |
||||||
|
<file>webui_hr.qm</file> |
||||||
|
<file>webui_hu.qm</file> |
||||||
|
<file>webui_hy.qm</file> |
||||||
|
<file>webui_id.qm</file> |
||||||
|
<file>webui_is.qm</file> |
||||||
|
<file>webui_it.qm</file> |
||||||
|
<file>webui_ja.qm</file> |
||||||
|
<file>webui_ka.qm</file> |
||||||
|
<file>webui_ko.qm</file> |
||||||
|
<file>webui_lt.qm</file> |
||||||
|
<file>webui_lv_LV.qm</file> |
||||||
|
<file>webui_ms_MY.qm</file> |
||||||
|
<file>webui_nb.qm</file> |
||||||
|
<file>webui_nl.qm</file> |
||||||
|
<file>webui_oc.qm</file> |
||||||
|
<file>webui_pl.qm</file> |
||||||
|
<file>webui_pt_BR.qm</file> |
||||||
|
<file>webui_pt_PT.qm</file> |
||||||
|
<file>webui_ro.qm</file> |
||||||
|
<file>webui_ru.qm</file> |
||||||
|
<file>webui_sk.qm</file> |
||||||
|
<file>webui_sl.qm</file> |
||||||
|
<file>webui_sr.qm</file> |
||||||
|
<file>webui_sv.qm</file> |
||||||
|
<file>webui_tr.qm</file> |
||||||
|
<file>webui_uk.qm</file> |
||||||
|
<file>webui_uz@Latn.qm</file> |
||||||
|
<file>webui_vi.qm</file> |
||||||
|
<file>webui_zh.qm</file> |
||||||
|
<file>webui_zh_HK.qm</file> |
||||||
|
<file>webui_zh_TW.qm</file> |
||||||
|
</qresource> |
||||||
|
</RCC> |
Loading…
Reference in new issue