mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 02:45:55 +08:00
Remove Qt translation generation and only use gettext for extracting translations
This commit is contained in:
parent
0a2baec53b
commit
8966054373
@ -12,10 +12,7 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
|
|||||||
|
|
||||||
# Build Translations
|
# Build Translations
|
||||||
find_package(Gettext)
|
find_package(Gettext)
|
||||||
find_package(Qt5LinguistTools QUIET CONFIG)
|
if(GETTEXT_FOUND)
|
||||||
if(GETTEXT_FOUND AND Qt5LinguistTools_FOUND)
|
|
||||||
include(${URANIUM_SCRIPTS_DIR}/ECMPoQmTools.cmake)
|
|
||||||
|
|
||||||
# translations target will convert .po files into .mo and .qm as needed.
|
# translations target will convert .po files into .mo and .qm as needed.
|
||||||
# The files are checked for a _qt suffix and if it is found, converted to
|
# The files are checked for a _qt suffix and if it is found, converted to
|
||||||
# qm, otherwise they are converted to .po.
|
# qm, otherwise they are converted to .po.
|
||||||
@ -36,26 +33,23 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
|
|||||||
it
|
it
|
||||||
es
|
es
|
||||||
fi
|
fi
|
||||||
|
pl
|
||||||
|
cs
|
||||||
|
bg
|
||||||
)
|
)
|
||||||
foreach(lang ${languages})
|
foreach(lang ${languages})
|
||||||
file(GLOB po_files resources/i18n/${lang}/*.po)
|
file(GLOB po_files resources/i18n/${lang}/*.po)
|
||||||
foreach(file ${po_files})
|
foreach(file ${po_files})
|
||||||
string(REGEX MATCH "qt\\.po$" match "${file}")
|
string(REGEX REPLACE ".*/(.*).po" "${lang}/\\1.mo" mofile ${file})
|
||||||
if(match)
|
add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${lang} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${file} -o ${mofile})
|
||||||
ecm_process_po_files_as_qm(${lang} PO_FILES ${file})
|
|
||||||
else()
|
|
||||||
string(REGEX REPLACE ".*/(.*).po" "${lang}/\\1.mo" mofile ${file})
|
|
||||||
add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${lang} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${file} -o ${mofile})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB qm_files ${CMAKE_BINARY_DIR}/${lang}/*.qm)
|
|
||||||
file(GLOB mo_files ${CMAKE_BINARY_DIR}/${lang}/*.mo)
|
file(GLOB mo_files ${CMAKE_BINARY_DIR}/${lang}/*.mo)
|
||||||
foreach(file ${qm_files} ${mo_files})
|
foreach(file ${mo_files})
|
||||||
add_custom_command(TARGET copy-translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND cp ARGS ${file} ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMENT "Copying ${file}...")
|
add_custom_command(TARGET copy-translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND cp ARGS ${file} ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMENT "Copying ${file}...")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
install(FILES ${qm_files} ${mo_files} DESTINATION ${CMAKE_INSTALL_DATADIR}/uranium/resources/i18n/${lang}/LC_MESSAGES/)
|
install(FILES ${mo_files} DESTINATION ${CMAKE_INSTALL_DATADIR}/uranium/resources/i18n/${lang}/LC_MESSAGES/)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user