|
|
@ -1916,49 +1916,53 @@ macro( tde_create_translated_desktop )
|
|
|
|
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
|
|
|
|
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
|
|
|
|
string( REPLACE "/" "+" _target "${_target}-translated" )
|
|
|
|
string( REPLACE "/" "+" _target "${_target}-translated" )
|
|
|
|
|
|
|
|
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
if( NOT TARGET ${_target} )
|
|
|
|
|
|
|
|
|
|
|
|
# Decide which translations to build; the ones selected in the
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
# LINGUAS environment variable, or all that are available.
|
|
|
|
|
|
|
|
if( DEFINED ENV{LINGUAS} )
|
|
|
|
|
|
|
|
set( _linguas "$ENV{LINGUAS}" )
|
|
|
|
|
|
|
|
else( )
|
|
|
|
|
|
|
|
string( REPLACE ".po;" " " _linguas "${_translations};" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
# Decide which translations to build; the ones selected in the
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
# LINGUAS environment variable, or all that are available.
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
if( DEFINED ENV{LINGUAS} )
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
set( _linguas "$ENV{LINGUAS}" )
|
|
|
|
endforeach( )
|
|
|
|
else( )
|
|
|
|
|
|
|
|
string( REPLACE ".po;" " " _linguas "${_translations};" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations command
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
get_filename_component( _src ${_src} ABSOLUTE )
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
add_custom_command(
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
|
|
|
|
endforeach( )
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else( )
|
|
|
|
# merge translations command
|
|
|
|
|
|
|
|
get_filename_component( _src ${_src} ABSOLUTE )
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
|
|
|
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# create template for intltool-merge
|
|
|
|
else( )
|
|
|
|
file( READ ${_src} _src_data )
|
|
|
|
|
|
|
|
string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
|
|
|
|
|
|
|
|
string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" )
|
|
|
|
|
|
|
|
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations command
|
|
|
|
# create template for intltool-merge
|
|
|
|
add_custom_command(
|
|
|
|
file( READ ${_src} _src_data )
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" )
|
|
|
|
DEPENDS ${_src}
|
|
|
|
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" )
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
# merge translations command
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations target
|
|
|
|
endif( )
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations target
|
|
|
|
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
else( )
|
|
|
|
else( )
|
|
|
|
|
|
|
|
|
|
|
|