mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 19:38:48 +03:00
Simplify translation adding
This commit is contained in:
parent
159bec3654
commit
843a619e70
2 changed files with 13 additions and 33 deletions
|
@ -580,10 +580,13 @@ qt_wrap_cpp(MOC_HEADERS
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bundle translations.
|
# Bundle resources
|
||||||
#
|
#
|
||||||
include(Translations)
|
if(Qt5QuickCompiler_FOUND AND COMPILE_QML)
|
||||||
set(TRANSLATION_DEPS ${LANG_QRC} ${QRC} ${QM_SRC})
|
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
||||||
|
else()
|
||||||
|
qt_add_resources(QRC resources/res.qrc)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications")
|
||||||
|
@ -619,7 +622,7 @@ set(NHEKO_DEPS
|
||||||
${SRC_FILES}
|
${SRC_FILES}
|
||||||
${UI_HEADERS}
|
${UI_HEADERS}
|
||||||
${MOC_HEADERS}
|
${MOC_HEADERS}
|
||||||
${TRANSLATION_DEPS}
|
${QRC}
|
||||||
${META_FILES_TO_INCLUDE})
|
${META_FILES_TO_INCLUDE})
|
||||||
|
|
||||||
if(ASAN)
|
if(ASAN)
|
||||||
|
@ -637,6 +640,12 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bundle translations
|
||||||
|
#
|
||||||
|
file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
|
||||||
|
qt_add_translations(nheko RESOURCE_PREFIX "/translations" TS_FILES ${LANG_TS_SRC})
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
|
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#
|
|
||||||
# Generate the translation resource file
|
|
||||||
#
|
|
||||||
|
|
||||||
file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
|
|
||||||
|
|
||||||
qt_add_translation(QM_SRC ${LANG_TS_SRC})
|
|
||||||
qt_create_translation(${QM_SRC})
|
|
||||||
add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})
|
|
||||||
set_target_properties(LANG_QRC PROPERTIES QT_RESOURCE_PREFIX /)
|
|
||||||
|
|
||||||
# Generate a qrc file for the translations
|
|
||||||
set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
|
||||||
|
|
||||||
if(NOT EXISTS ${_qrc})
|
|
||||||
file(WRITE ${_qrc} "<RCC>\n <qresource prefix=\"/translations\">\n")
|
|
||||||
foreach(_lang ${QM_SRC})
|
|
||||||
get_filename_component(_filename ${_lang} NAME)
|
|
||||||
file(APPEND ${_qrc} " <file>${_filename}</file>\n")
|
|
||||||
endforeach(_lang)
|
|
||||||
file(APPEND ${_qrc} " </qresource>\n</RCC>\n")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
qt_add_resources(LANG_QRC ${_qrc})
|
|
||||||
if(Qt5QuickCompiler_FOUND AND COMPILE_QML)
|
|
||||||
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
|
||||||
else()
|
|
||||||
qt_add_resources(QRC resources/res.qrc)
|
|
||||||
endif()
|
|
Loading…
Reference in a new issue