|
|
@ -1049,6 +1049,7 @@ macro( tde_create_translation )
|
|
|
|
unset( _srcs )
|
|
|
|
unset( _srcs )
|
|
|
|
unset( _lang )
|
|
|
|
unset( _lang )
|
|
|
|
unset( _dest )
|
|
|
|
unset( _dest )
|
|
|
|
|
|
|
|
unset( _out_name )
|
|
|
|
unset( _directive )
|
|
|
|
unset( _directive )
|
|
|
|
unset( _var )
|
|
|
|
unset( _var )
|
|
|
|
|
|
|
|
|
|
|
@ -1075,6 +1076,13 @@ macro( tde_create_translation )
|
|
|
|
set( _directive 1 )
|
|
|
|
set( _directive 1 )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# found directive "DESTINATION"
|
|
|
|
|
|
|
|
if( "${_arg}" STREQUAL "OUTPUT_NAME" )
|
|
|
|
|
|
|
|
unset( _proj )
|
|
|
|
|
|
|
|
set( _var _out_name )
|
|
|
|
|
|
|
|
set( _directive 1 )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
# collect data
|
|
|
|
# collect data
|
|
|
|
if( _directive )
|
|
|
|
if( _directive )
|
|
|
|
unset( _directive )
|
|
|
|
unset( _directive )
|
|
|
@ -1088,8 +1096,6 @@ macro( tde_create_translation )
|
|
|
|
tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" )
|
|
|
|
tde_message_fatal( "MSGFMT_EXECUTABLE variable is not defined" )
|
|
|
|
elseif( NOT _lang )
|
|
|
|
elseif( NOT _lang )
|
|
|
|
tde_message_fatal( "missing LANG directive" )
|
|
|
|
tde_message_fatal( "missing LANG directive" )
|
|
|
|
elseif( NOT _dest )
|
|
|
|
|
|
|
|
set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
# if no file specified, include all *.po files
|
|
|
|
# if no file specified, include all *.po files
|
|
|
@ -1100,18 +1106,50 @@ macro( tde_create_translation )
|
|
|
|
tde_message_fatal( "no source files" )
|
|
|
|
tde_message_fatal( "no source files" )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( NOT _lang STREQUAL "auto")
|
|
|
|
|
|
|
|
set( _real_lang ${_lang} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( NOT _dest )
|
|
|
|
|
|
|
|
set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# OUTPUT_NAME can only be used if we have only one file
|
|
|
|
|
|
|
|
list( LENGTH _srcs _srcs_num)
|
|
|
|
|
|
|
|
if( _out_name AND _srcs_num GREATER 1 )
|
|
|
|
|
|
|
|
tde_message_fatal( "OUTPUT_NAME can be supplied only with single file or LANG=auto" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elseif( NOT _out_name )
|
|
|
|
|
|
|
|
tde_message_fatal( "LANG=auto reqires OUTPUT_NAME directive to be set" )
|
|
|
|
|
|
|
|
elseif( _dest )
|
|
|
|
|
|
|
|
tde_message_fatal( "DESTINATION cannot be used with LANG=auto" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
# generate *.mo files
|
|
|
|
# generate *.mo files
|
|
|
|
foreach( _src ${_srcs} )
|
|
|
|
foreach( _src ${_srcs} )
|
|
|
|
|
|
|
|
|
|
|
|
get_filename_component( _src ${_src} ABSOLUTE )
|
|
|
|
get_filename_component( _src ${_src} ABSOLUTE )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( _out_name )
|
|
|
|
|
|
|
|
set( _out ${_out_name} )
|
|
|
|
|
|
|
|
if( _lang STREQUAL "auto" )
|
|
|
|
|
|
|
|
get_filename_component( _real_lang ${_src} NAME_WE )
|
|
|
|
|
|
|
|
set( _dest "${LOCALE_INSTALL_DIR}/${_real_lang}/LC_MESSAGES" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
else( )
|
|
|
|
get_filename_component( _out ${_src} NAME_WE )
|
|
|
|
get_filename_component( _out ${_src} NAME_WE )
|
|
|
|
set( _out_name "${_out}-${_lang}.mo" )
|
|
|
|
endif( )
|
|
|
|
set( _out_real_name "${_out}.mo" )
|
|
|
|
|
|
|
|
|
|
|
|
set( _out_filename "${_out}-${_real_lang}.mo" )
|
|
|
|
|
|
|
|
set( _install_filename "${_out}.mo" )
|
|
|
|
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${_out_name}
|
|
|
|
OUTPUT ${_out_filename}
|
|
|
|
COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_name}
|
|
|
|
COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_filename}
|
|
|
|
DEPENDS ${_src} )
|
|
|
|
DEPENDS ${_src} )
|
|
|
|
add_custom_target( "${_out}-${_lang}-translation" ALL DEPENDS ${_out_name} )
|
|
|
|
add_custom_target( "${_out}-${_real_lang}-translation" ALL DEPENDS ${_out_filename} )
|
|
|
|
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} RENAME ${_out_real_name} DESTINATION ${_dest} )
|
|
|
|
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_filename} RENAME ${_install_filename} DESTINATION ${_dest} )
|
|
|
|
|
|
|
|
|
|
|
|
endforeach( )
|
|
|
|
endforeach( )
|
|
|
|
|
|
|
|
|
|
|
|
endmacro( )
|
|
|
|
endmacro( )
|
|
|
|