2020-08-25 16:05:56 +02:00
|
|
|
# === This file is part of Calamares - <https://calamares.io> ===
|
2018-05-07 14:41:01 +02:00
|
|
|
#
|
2020-08-26 00:24:52 +02:00
|
|
|
# SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2018-05-07 14:41:01 +02:00
|
|
|
#
|
|
|
|
###
|
2021-09-07 16:31:24 +02:00
|
|
|
#
|
|
|
|
# This CMakeList handles the following i18n / language targets:
|
|
|
|
#
|
|
|
|
# - creating a translation test-tool
|
|
|
|
# - building the Python (gettext-based) translations
|
|
|
|
# - compiling all the Qt translations into a C++ file calamares-i18n.cxx
|
|
|
|
# - defines an OBJECT LIBRARY calamares-i18n for linking the compiled
|
|
|
|
# translations into an executable.
|
2018-05-07 14:41:01 +02:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
include(CalamaresAddTranslations)
|
2020-08-27 13:59:23 +02:00
|
|
|
|
2018-12-11 13:55:31 +01:00
|
|
|
find_package(Qt5 COMPONENTS Xml)
|
2022-02-08 16:18:47 +01:00
|
|
|
if(Qt5Xml_FOUND)
|
2018-12-11 13:55:31 +01:00
|
|
|
add_executable(txload txload.cpp)
|
|
|
|
target_link_libraries(txload Qt5::Xml)
|
|
|
|
endif()
|
2020-08-27 13:59:23 +02:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
install_calamares_gettext_translations(python
|
2020-08-27 13:59:23 +02:00
|
|
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/lang/python
|
|
|
|
FILENAME python.mo
|
|
|
|
RENAME calamares-python.mo
|
|
|
|
)
|
2021-09-07 16:31:24 +02:00
|
|
|
|
|
|
|
### TRANSLATIONS
|
|
|
|
#
|
|
|
|
#
|
2022-02-08 16:18:47 +01:00
|
|
|
set(TS_FILES "")
|
|
|
|
set(calamares_i18n_qrc_content "")
|
2021-09-07 16:31:24 +02:00
|
|
|
|
|
|
|
# calamares and qt language files
|
2022-02-08 16:18:47 +01:00
|
|
|
foreach(lang ${CALAMARES_TRANSLATION_LANGUAGES})
|
|
|
|
foreach(tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}")
|
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
|
|
|
|
string(APPEND calamares_i18n_qrc_content "<file>${tlsource}.qm</file>\n")
|
|
|
|
list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
|
2021-09-07 16:31:24 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
set(trans_file calamares_i18n)
|
|
|
|
set(trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
|
|
|
|
set(trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx)
|
|
|
|
set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile})
|
2021-09-07 16:31:24 +02:00
|
|
|
|
2022-02-08 16:18:47 +01:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
|
2021-09-07 16:31:24 +02:00
|
|
|
|
|
|
|
qt5_add_translation(QM_FILES ${TS_FILES})
|
|
|
|
|
|
|
|
# Run the resource compiler (rcc_options should already be set)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${trans_outfile}
|
|
|
|
COMMAND "${Qt5Core_RCC_EXECUTABLE}"
|
|
|
|
ARGS ${rcc_options} --format-version 1 -name ${trans_file} -o ${trans_outfile} ${trans_infile}
|
|
|
|
MAIN_DEPENDENCY ${trans_infile}
|
|
|
|
DEPENDS ${QM_FILES}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(calamares-i18n OBJECT ${trans_outfile})
|