|
|
|
@ -1916,49 +1916,53 @@ macro( tde_create_translated_desktop )
|
|
|
|
|
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
|
|
|
|
|
string( REPLACE "/" "+" _target "${_target}-translated" )
|
|
|
|
|
|
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
|
if( NOT TARGET ${_target} )
|
|
|
|
|
|
|
|
|
|
# Decide which translations to build; the ones selected in the
|
|
|
|
|
# LINGUAS environment variable, or all that are available.
|
|
|
|
|
if( DEFINED ENV{LINGUAS} )
|
|
|
|
|
set( _linguas "$ENV{LINGUAS}" )
|
|
|
|
|
else( )
|
|
|
|
|
string( REPLACE ".po;" " " _linguas "${_translations};" )
|
|
|
|
|
endif( )
|
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
|
|
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
|
endforeach( )
|
|
|
|
|
# Decide which translations to build; the ones selected in the
|
|
|
|
|
# LINGUAS environment variable, or all that are available.
|
|
|
|
|
if( DEFINED ENV{LINGUAS} )
|
|
|
|
|
set( _linguas "$ENV{LINGUAS}" )
|
|
|
|
|
else( )
|
|
|
|
|
string( REPLACE ".po;" " " _linguas "${_translations};" )
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
# 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}
|
|
|
|
|
)
|
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
|
endforeach( )
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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}" )
|
|
|
|
|
else( )
|
|
|
|
|
|
|
|
|
|
# merge translations command
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
)
|
|
|
|
|
# create template for intltool-merge
|
|
|
|
|
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}" )
|
|
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
# merge translations command
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# merge translations target
|
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
# merge translations target
|
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
else( )
|
|
|
|
|
|
|
|
|
|