mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Merge pull request #2976
a00ed6a
cmake: implement translations support (xiphon)
This commit is contained in:
commit
14cc1d096a
3 changed files with 27 additions and 2 deletions
|
@ -487,4 +487,7 @@ if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(translations)
|
||||
get_directory_property(TRANSLATIONS_QRC DIRECTORY translations DEFINITION TRANSLATIONS_QRC)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -6,7 +6,7 @@ add_subdirectory(model)
|
|||
add_subdirectory(openpgp)
|
||||
add_subdirectory(zxcvbn-c)
|
||||
|
||||
qt5_add_resources(RESOURCES ../qml.qrc)
|
||||
qt5_add_resources(RESOURCES ../qml.qrc ${TRANSLATIONS_QRC})
|
||||
|
||||
# Compile source files (.h/.cpp)
|
||||
file(GLOB SOURCE_FILES
|
||||
|
|
|
@ -1 +1,23 @@
|
|||
qt5_add_resources(RESOURCE_FILES *.ts)
|
||||
file(GLOB TS_FILES *.ts)
|
||||
|
||||
set(QRC "<RCC><qresource prefix=\"/\">")
|
||||
foreach(TS_FILE ${TS_FILES})
|
||||
get_filename_component(QM_FILE ${TS_FILE} NAME_WE)
|
||||
set(QM_FILE ${CMAKE_CURRENT_BINARY_DIR}/${QM_FILE}.qm)
|
||||
|
||||
execute_process(COMMAND lrelease -compress -nounfinished -removeidentical ${TS_FILE} -qm ${QM_FILE}
|
||||
RESULT_VARIABLE RET
|
||||
OUTPUT_VARIABLE OUT
|
||||
ERROR_VARIABLE ERR
|
||||
)
|
||||
if(RET)
|
||||
message(FATAL_ERROR "${TS_FILE}: lrelease returned non-zero exit code: ${RET} ${OUT} ${ERR}")
|
||||
endif()
|
||||
|
||||
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
|
||||
string(APPEND QRC "<file>${QM_FILE_NAME}</file>")
|
||||
endforeach()
|
||||
string(APPEND QRC "</qresource></RCC>")
|
||||
|
||||
set(TRANSLATIONS_QRC ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
||||
file(WRITE ${TRANSLATIONS_QRC} ${QRC})
|
||||
|
|
Loading…
Reference in a new issue