Commit be4c84e2 authored by Stéphane Albert's avatar Stéphane Albert

ENH: Added I18N support to Monteverdi modules.

parent 8cc4ee64
#
# Declare and initialize variable to be present in parent scope.
# set( Monteverdi_I18N_SOURCE_FILES
# ""
# CACHE INTERNAL "" FORCE
# )
# Reset Qt I18N source files cache variable.
macro( reset_qt4_i18n_sources )
set( OTB_QT_I18N_SOURCE_FILES "" CACHE INTERNAL "" FORCE )
endmacro()
#
# Set locale human-readable translation files.
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_sources SOURCE_FILES )
foreach(SOURCE_FILE ${ARGV})
foreach( SOURCE_FILE ${ARGV} )
get_filename_component( ABS_SOURCE_FILE ${SOURCE_FILE} ABSOLUTE )
set( Monteverdi_I18N_SOURCE_FILES
${Monteverdi_I18N_SOURCE_FILES} ${ABS_SOURCE_FILE}
set( OTB_QT_I18N_SOURCE_FILES
${OTB_QT_I18N_SOURCE_FILES} ${ABS_SOURCE_FILE}
CACHE INTERNAL "" FORCE
)
endforeach()
endmacro()
......@@ -67,6 +67,9 @@ include(PreventInBuildInstalls)
include(OTBModuleMacros)
include(OTBModuleRemote)
include(OTBModuleTest)
include( i18n_qt4 )
reset_qt4_i18n_sources()
repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
......@@ -361,7 +364,7 @@ add_subdirectory(Utilities/Doxygen)
add_subdirectory(Utilities/Completion)
#----------------------------------------------------------------------
#----------------------------------------------------------------------------
# Provide a target to generate the SuperBuild archive (only for Unix)
if(UNIX)
add_custom_target(SuperBuild-archive
......@@ -522,3 +525,7 @@ message("======================= End of OTB cmake summary ======================
#don't need this one anymore. so unset it.
unset(option_list)
#----------------------------------------------------------------------------
# I18N
add_subdirectory( i18n )
......@@ -45,6 +45,9 @@ qt4_wrap_cpp( OTBMapla_SRC_MOC ${OTBMapla_HEADERS_MOC} )
qt4_wrap_ui( OTBMapla_FORMS_HEADERS ${OTBMapla_FORMS} )
qt4_add_resources( OTBMapla_RESOURCES_RCC ${OTBMapla_RESOURCES} )
#############################################################################
add_to_qt4_i18n_sources( ${OTBMapla_SRCS} )
##########################[Mapla library]####################################
add_library( OTBMapla
STATIC
......
......@@ -46,7 +46,7 @@ namespace mvd
{
/*
TRANSLATOR mvd::Application
TRANSLATOR mvd::MaplaApplication
Necessary for lupdate to be aware of C++ namespaces.
......
......@@ -59,7 +59,7 @@ namespace mvd
{
/*
TRANSLATOR mvd::MainWindow
TRANSLATOR mvd::MaplaMainWindow
Necessary for lupdate to be aware of C++ namespaces.
......
......@@ -28,7 +28,10 @@ qt4_wrap_cpp( OTBMonteverdi_SRC_MOC ${OTBMonteverdi_HEADERS_MOC} )
qt4_wrap_ui( OTBMonteverdi_FORMS_HEADERS ${OTBMonteverdi_FORMS} )
qt4_add_resources( OTBMonteverdi_RESOURCES_RCC ${OTBMonteverdi_RESOURCES} )
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdi_SRCS} )
#############################################################################
add_library( OTBMonteverdi
STATIC
${OTBMonteverdi_SRCS}
......
......@@ -70,7 +70,9 @@ if( OTBApplicationEngine_ENABLED )
endif()
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdiCore_SRCS} )
#############################################################################
qt4_wrap_cpp( OTBMonteverdiCore_SRC_MOC ${OTBMonteverdiCore_HEADERS_MOC} )
add_library( OTBMonteverdiCore ${OTBMonteverdiCore_SRCS} ${OTBMonteverdiCore_SRC_MOC})
......
......@@ -155,6 +155,9 @@ qt4_wrap_cpp( OTBMonteverdiGUI_SRC_MOC ${OTBMonteverdiGUI_HEADERS_MOC} )
qt4_wrap_ui( OTBMonteverdiGUI_FORMS_HEADERS ${OTBMonteverdiGUI_FORMS} )
qt4_add_resources( OTBMonteverdiGUI_RESOURCES_RCC ${OTBMonteverdiGUI_RESOURCES} )
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdiGUI_SRCS} )
#############################################################################
add_library( OTBMonteverdiGUI
${OTBMonteverdiGUI_SRCS}
......
......@@ -2,39 +2,50 @@
# Qt4 translations.
#----------------------------------------------------------------------------
# Locale human-readable translation files.
set( Monteverdi_TS_TRANSLATIONS
set( OTB_TS_TRANSLATIONS
# en_US.ts
fr_FR.ts
)
#
#----------------------------------------------------------------------------
# Configuration option to enable creation/merging of source .ts files
# Default value is: OFF.
option( MERGE_TS "Create/merge .ts source translation files. WARNING: 'make clean' will delete the source .ts files!" OFF)
#
# Sources to translate.
if( MERGE_TS )
message( AUTHOR_WARNING "WARNING: MERGE_TS:BOOL option is ON. 'make clean' will delete .ts files from source directory!" )
message( STATUS "I18N source files: " ${Monteverdi_I18N_SOURCE_FILES} )
qt4_create_translation( Monteverdi_QM_TRANSLATIONS
${Monteverdi_I18N_SOURCE_FILES}
${Monteverdi_TS_TRANSLATIONS}
)
else()
#
# Locale binary translation files.
qt4_add_translation( Monteverdi_QM_TRANSLATIONS
${Monteverdi_TS_TRANSLATIONS}
option( OTB_I18N_MERGE_TS
"Create/merge .ts source translation files. WARNING: If ON, 'make clean' will delete the .ts files from source directory!"
OFF
)
endif()
#
# Custom build target.
add_custom_target( i18n ALL DEPENDS ${Monteverdi_QM_TRANSLATIONS} )
#
#----------------------------------------------------------------------------
# Locale human-readable translation files.
install(
FILES ${Monteverdi_QM_TRANSLATIONS}
DESTINATION ${Monteverdi_INSTALL_DATA_DIR}/i18n
COMPONENT Resources
)
if( OTBQt4_ENABLED )
# Generate commands to build Qt translations according to option.
if( OTB_I18N_MERGE_TS )
message(
AUTHOR_WARNING
"WARNING: OTB_I18N_MERGE_TS:BOOL option is set to ON. 'make clean' will delete .ts files from source directory!"
)
message( STATUS "Qt I18N source files: " ${OTB_QT_I18N_SOURCE_FILES} )
qt4_create_translation( OTB_QM_TRANSLATIONS
${OTB_QT_I18N_SOURCE_FILES}
${OTB_TS_TRANSLATIONS}
)
else()
qt4_add_translation( OTB_QM_TRANSLATIONS
${OTB_TS_TRANSLATIONS}
)
endif()
# Custom build targets.
add_custom_target( i18n ALL DEPENDS i18n_qt )
add_custom_target( i18n_qt DEPENDS ${OTB_QM_TRANSLATIONS} )
# Locale human-readable translation files.
install(
FILES ${OTB_QM_TRANSLATIONS}
DESTINATION ${OTB_INSTALL_DATA_DIR}/i18n
COMPONENT Resources
)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment