Change behavior of generating translations
- translations are now generated by default with Python as required dependency - old behavior of installing only English files is provided as an option (configure with -DTRANSLATIONS=0)coolant-mod
parent
193c82e590
commit
e58534ab5a
|
@ -1,9 +1,11 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
find_package(PythonInterp 2.7)
|
||||
option(TRANSLATIONS "Enable translations of help and level files" ON)
|
||||
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
message(WARNING "Python not found, help and level files will NOT be translated!")
|
||||
if(TRANSLATIONS)
|
||||
find_package(PythonInterp 2.7 REQUIRED)
|
||||
else()
|
||||
message(STATUS "Translations disabled; only English files will be installed")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED COLOBOT_INSTALL_DATA_DIR)
|
||||
|
|
|
@ -9,12 +9,14 @@ set(HELP_INSTALL_DATA_DIR ${COLOBOT_INSTALL_DATA_DIR}/help)
|
|||
##
|
||||
function(add_help_category help_category_dir install_subdir)
|
||||
|
||||
message(STATUS "Adding translation targets for help/${help_category_dir}")
|
||||
|
||||
# Always install English files
|
||||
file(GLOB english_help_files ${help_category_dir}/E/*)
|
||||
install(FILES ${english_help_files} DESTINATION ${HELP_INSTALL_DATA_DIR}/E/${install_subdir})
|
||||
|
||||
if(PYTHONINTERP_FOUND)
|
||||
# If translations are turned on, also generate translated files
|
||||
if(TRANSLATIONS)
|
||||
message(STATUS "Adding translation targets for help/${help_category_dir}")
|
||||
|
||||
set(work_dir ${DATA_BINARY_DIR}/help-po/${help_category_dir})
|
||||
generate_translations(translated_help_files
|
||||
"help"
|
||||
|
|
|
@ -9,14 +9,14 @@ set(LEVEL_INSTALL_DATA_DIR ${COLOBOT_INSTALL_DATA_DIR}/levels)
|
|||
##
|
||||
function(add_level_category level_category_dir)
|
||||
|
||||
message(STATUS "Adding translation targets for level/${level_category_dir}")
|
||||
|
||||
# Without Python, just install all files as they are
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
# If translations are turned off, just install all files as they are
|
||||
if(NOT TRANSLATIONS)
|
||||
install(DIRECTORY ${level_category_dir} DESTINATION ${LEVEL_INSTALL_DATA_DIR})
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Adding translation targets for level/${level_category_dir}")
|
||||
|
||||
add_chaptertitles(${level_category_dir})
|
||||
|
||||
file(GLOB level_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${level_category_dir}/chapter*/level*)
|
||||
|
|
Loading…
Reference in New Issue