Add verbose option for translation generation in CMake configuration

This commit introduces a new option, TRANSLATIONS_VERBOSE, to the CMakeLists.txt file, allowing users to enable verbose output during the generation of .qm translation files. The qt_add_lrelease command is modified to conditionally include the -silent option based on the value of TRANSLATIONS_VERBOSE, improving the build process for translations.
This commit is contained in:
2026-01-22 14:37:11 +09:00
parent b65f33f6bd
commit 49cd7a6210

View File

@@ -1529,10 +1529,15 @@ if(HAVE_DISCORD_RPC)
endif() endif()
if(HAVE_TRANSLATIONS) if(HAVE_TRANSLATIONS)
option(TRANSLATIONS_VERBOSE "Show verbose output while generating .qm translation files" OFF)
qt_add_lupdate(strawberry_lib TS_FILES "${CMAKE_SOURCE_DIR}/src/translations/strawberry_en_US.ts" OPTIONS -locations none -no-ui-lines -no-obsolete) qt_add_lupdate(strawberry_lib TS_FILES "${CMAKE_SOURCE_DIR}/src/translations/strawberry_en_US.ts" OPTIONS -locations none -no-ui-lines -no-obsolete)
file(GLOB_RECURSE ts_files ${CMAKE_SOURCE_DIR}/src/translations/*.ts) file(GLOB_RECURSE ts_files ${CMAKE_SOURCE_DIR}/src/translations/*.ts)
set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/data") set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/data")
qt_add_lrelease(strawberry TS_FILES ${ts_files} QM_FILES_OUTPUT_VARIABLE INSTALL_TRANSLATIONS_FILES) if(TRANSLATIONS_VERBOSE)
qt_add_lrelease(strawberry TS_FILES ${ts_files} QM_FILES_OUTPUT_VARIABLE INSTALL_TRANSLATIONS_FILES)
else()
qt_add_lrelease(strawberry TS_FILES ${ts_files} QM_FILES_OUTPUT_VARIABLE INSTALL_TRANSLATIONS_FILES OPTIONS -silent)
endif()
if(NOT INSTALL_TRANSLATIONS) if(NOT INSTALL_TRANSLATIONS)
qt_add_resources(strawberry "translations" PREFIX "/i18n" BASE "${CMAKE_CURRENT_BINARY_DIR}/data" FILES "${INSTALL_TRANSLATIONS_FILES}") qt_add_resources(strawberry "translations" PREFIX "/i18n" BASE "${CMAKE_CURRENT_BINARY_DIR}/data" FILES "${INSTALL_TRANSLATIONS_FILES}")
endif() endif()