|
|
@ -1771,13 +1771,13 @@ endmacro( )
|
|
|
|
|
|
|
|
|
|
|
|
macro( tde_create_translated_desktop )
|
|
|
|
macro( tde_create_translated_desktop )
|
|
|
|
|
|
|
|
|
|
|
|
unset( _src )
|
|
|
|
unset( _srcs )
|
|
|
|
|
|
|
|
unset( _arg_out_name )
|
|
|
|
|
|
|
|
unset( _arg_po_dir )
|
|
|
|
unset( _keywords_add )
|
|
|
|
unset( _keywords_add )
|
|
|
|
unset( _po_dir )
|
|
|
|
|
|
|
|
unset( _dest )
|
|
|
|
unset( _dest )
|
|
|
|
unset( _out_name )
|
|
|
|
|
|
|
|
unset( _directive )
|
|
|
|
unset( _directive )
|
|
|
|
set( _var _src )
|
|
|
|
set( _var _srcs )
|
|
|
|
set( _keywords_desktop_default
|
|
|
|
set( _keywords_desktop_default
|
|
|
|
"Name" "GenericName" "Comment" "Keywords"
|
|
|
|
"Name" "GenericName" "Comment" "Keywords"
|
|
|
|
"Description" "ExtraNames" "X-TDE-Submenu" )
|
|
|
|
"Description" "ExtraNames" "X-TDE-Submenu" )
|
|
|
@ -1786,8 +1786,8 @@ macro( tde_create_translated_desktop )
|
|
|
|
|
|
|
|
|
|
|
|
# found directive "SOURCE"
|
|
|
|
# found directive "SOURCE"
|
|
|
|
if( "+${_arg}" STREQUAL "+SOURCE" )
|
|
|
|
if( "+${_arg}" STREQUAL "+SOURCE" )
|
|
|
|
unset( _src )
|
|
|
|
unset( _srcs )
|
|
|
|
set( _var _src )
|
|
|
|
set( _var _srcs )
|
|
|
|
set( _directive 1 )
|
|
|
|
set( _directive 1 )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
@ -1800,8 +1800,8 @@ macro( tde_create_translated_desktop )
|
|
|
|
|
|
|
|
|
|
|
|
# found directive "PO_DIR"
|
|
|
|
# found directive "PO_DIR"
|
|
|
|
if( "+${_arg}" STREQUAL "+PO_DIR" )
|
|
|
|
if( "+${_arg}" STREQUAL "+PO_DIR" )
|
|
|
|
unset( _po_dir )
|
|
|
|
unset( _arg_po_dir )
|
|
|
|
set( _var _po_dir )
|
|
|
|
set( _var _arg_po_dir )
|
|
|
|
set( _directive 1 )
|
|
|
|
set( _directive 1 )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
@ -1814,8 +1814,8 @@ macro( tde_create_translated_desktop )
|
|
|
|
|
|
|
|
|
|
|
|
# found directive "OUTPUT_NAME"
|
|
|
|
# found directive "OUTPUT_NAME"
|
|
|
|
if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
|
|
|
|
if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
|
|
|
|
unset( _out_name )
|
|
|
|
unset( _arg_out_name )
|
|
|
|
set( _var _out_name )
|
|
|
|
set( _var _arg_out_name )
|
|
|
|
set( _directive 1 )
|
|
|
|
set( _directive 1 )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
@ -1828,6 +1828,22 @@ macro( tde_create_translated_desktop )
|
|
|
|
|
|
|
|
|
|
|
|
endforeach( )
|
|
|
|
endforeach( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# no source file specified!
|
|
|
|
|
|
|
|
if( NOT _srcs )
|
|
|
|
|
|
|
|
tde_message_fatal( "no source desktop file specified" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# OUTPUT_NAME can only be used if we have only one file
|
|
|
|
|
|
|
|
list( LENGTH _srcs _srcs_num )
|
|
|
|
|
|
|
|
if( _arg_out_name AND _srcs_num GREATER 1 )
|
|
|
|
|
|
|
|
tde_message_fatal( "OUTPUT_NAME can be supplied only with single file" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if no destination directory specified, install as application link
|
|
|
|
|
|
|
|
if( NOT _dest )
|
|
|
|
|
|
|
|
set( _dest ${XDG_APPS_INSTALL_DIR} )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
# select a tool for merging desktop file translations
|
|
|
|
# select a tool for merging desktop file translations
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Because some of our desktop files contain underscores in variable
|
|
|
|
# Because some of our desktop files contain underscores in variable
|
|
|
@ -1868,132 +1884,131 @@ macro( tde_create_translated_desktop )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
endforeach( )
|
|
|
|
endforeach( )
|
|
|
|
|
|
|
|
|
|
|
|
# no source file specified!
|
|
|
|
# process source files
|
|
|
|
if( NOT _src )
|
|
|
|
foreach( _src IN LISTS _srcs )
|
|
|
|
tde_message_fatal( "no source desktop file specified" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
get_filename_component( _basename ${_src} ABSOLUTE )
|
|
|
|
|
|
|
|
get_filename_component( _basedir ${_basename} PATH )
|
|
|
|
|
|
|
|
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# prepare the binary directory according to source directory
|
|
|
|
|
|
|
|
file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_basedir}" )
|
|
|
|
|
|
|
|
set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" )
|
|
|
|
|
|
|
|
file( MAKE_DIRECTORY "${_binary_basedir}" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# process source file as a configuration file if necessary
|
|
|
|
# get a base name and a directory
|
|
|
|
if( "${_src}" MATCHES "\\.cmake$" )
|
|
|
|
get_filename_component( _basename ${_src} ABSOLUTE )
|
|
|
|
configure_file( ${_src} ${_basename} @ONLY )
|
|
|
|
get_filename_component( _basedir ${_basename} PATH )
|
|
|
|
set( ${_src} "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" )
|
|
|
|
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" )
|
|
|
|
string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" )
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if no output name specified, use the same as source
|
|
|
|
# prepare the binary directory according to source directory
|
|
|
|
if( NOT _out_name )
|
|
|
|
file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_basedir}" )
|
|
|
|
get_filename_component( _out_name ${_basename} NAME )
|
|
|
|
set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" )
|
|
|
|
endif( )
|
|
|
|
file( MAKE_DIRECTORY "${_binary_basedir}" )
|
|
|
|
|
|
|
|
|
|
|
|
# determine po directory
|
|
|
|
# process source file as a configuration file if necessary
|
|
|
|
if( _po_dir )
|
|
|
|
if( "${_src}" MATCHES "\\.cmake$" )
|
|
|
|
set( _po_base ${_po_dir} )
|
|
|
|
configure_file( ${_src} ${_basename} @ONLY )
|
|
|
|
else()
|
|
|
|
set( ${_src} "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" )
|
|
|
|
get_filename_component( _po_base ${_basename} NAME )
|
|
|
|
string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if( IS_ABSOLUTE ${_po_base} )
|
|
|
|
|
|
|
|
set( _po_dir ${_po_base} )
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
if( EXISTS ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} AND
|
|
|
|
|
|
|
|
IS_DIRECTORY ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elseif( EXISTS ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} AND
|
|
|
|
# determine output name
|
|
|
|
IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
|
|
|
|
if( _arg_out_name )
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
|
|
|
|
set( _out_name ${_arg_out_name} )
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
get_filename_component( _out_name ${_basename} NAME )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# determine po directory
|
|
|
|
|
|
|
|
if( _arg_po_dir )
|
|
|
|
|
|
|
|
set( _po_base ${_arg_po_dir} )
|
|
|
|
else()
|
|
|
|
else()
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files )
|
|
|
|
get_filename_component( _po_base ${_basename} NAME )
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if( IS_ABSOLUTE ${_po_base} )
|
|
|
|
|
|
|
|
set( _po_dir ${_po_base} )
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
if( EXISTS ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} AND
|
|
|
|
|
|
|
|
IS_DIRECTORY ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elseif( EXISTS ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} AND
|
|
|
|
|
|
|
|
IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if no destination directory specified, install as application link
|
|
|
|
# are there any translations available?
|
|
|
|
if( NOT _dest )
|
|
|
|
unset( _translations )
|
|
|
|
set( _dest ${XDG_APPS_INSTALL_DIR} )
|
|
|
|
if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" )
|
|
|
|
endif( )
|
|
|
|
file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
if( _translations )
|
|
|
|
|
|
|
|
|
|
|
|
# are there any translations available?
|
|
|
|
# prepare a full name for the target
|
|
|
|
unset( _translations )
|
|
|
|
get_filename_component( _target ${_basename} ABSOLUTE )
|
|
|
|
if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" )
|
|
|
|
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
|
|
|
|
file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" )
|
|
|
|
string( REPLACE "/" "+" _target "${_target}-translated" )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
if( _translations )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# prepare a full name for the target
|
|
|
|
if( NOT TARGET ${_target} )
|
|
|
|
get_filename_component( _target ${_basename} ABSOLUTE )
|
|
|
|
|
|
|
|
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
|
|
|
|
|
|
|
|
string( REPLACE "/" "+" _target "${_target}-translated" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( NOT TARGET ${_target} )
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
|
|
|
|
|
|
|
|
if( DESKTOP_MERGE_MSGFMT )
|
|
|
|
# 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( )
|
|
|
|
|
|
|
|
|
|
|
|
# Decide which translations to build; the ones selected in the
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
# LINGUAS environment variable, or all that are available.
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
if( DEFINED ENV{LINGUAS} )
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
set( _linguas "$ENV{LINGUAS}" )
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
else( )
|
|
|
|
endforeach( )
|
|
|
|
string( REPLACE ".po;" " " _linguas "${_translations};" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# prepare keywords for msgfmt
|
|
|
|
# merge translations command
|
|
|
|
set( _keywords_arg "--keyword=" )
|
|
|
|
get_filename_component( _src ${_src} ABSOLUTE )
|
|
|
|
foreach( _keyword ${_keywords_desktop} )
|
|
|
|
add_custom_command(
|
|
|
|
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
endforeach( )
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
|
|
|
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations command
|
|
|
|
else( )
|
|
|
|
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}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else( )
|
|
|
|
# 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}" )
|
|
|
|
|
|
|
|
|
|
|
|
# create template for intltool-merge
|
|
|
|
# merge translations command
|
|
|
|
file( READ ${_src} _src_data )
|
|
|
|
add_custom_command(
|
|
|
|
string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" )
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" )
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations command
|
|
|
|
endif( )
|
|
|
|
add_custom_command(
|
|
|
|
|
|
|
|
OUTPUT ${_basename}
|
|
|
|
|
|
|
|
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
|
|
|
|
|
|
|
|
DEPENDS ${_src}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
# merge translations target
|
|
|
|
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
|
|
|
|
|
|
|
# merge translations target
|
|
|
|
endif()
|
|
|
|
add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif()
|
|
|
|
else( )
|
|
|
|
|
|
|
|
|
|
|
|
else( )
|
|
|
|
# just write the original file without translations
|
|
|
|
|
|
|
|
file( READ ${_src} _src_data )
|
|
|
|
|
|
|
|
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename} "${_src_data}" )
|
|
|
|
|
|
|
|
|
|
|
|
# just write the original file without translations
|
|
|
|
endif( )
|
|
|
|
file( READ ${_src} _src_data )
|
|
|
|
|
|
|
|
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename} "${_src_data}" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
# install traslated desktop file
|
|
|
|
|
|
|
|
install(
|
|
|
|
|
|
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}
|
|
|
|
|
|
|
|
RENAME ${_out_name}
|
|
|
|
|
|
|
|
DESTINATION ${_dest}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# install traslated desktop file
|
|
|
|
endforeach()
|
|
|
|
install(
|
|
|
|
|
|
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}
|
|
|
|
|
|
|
|
RENAME ${_out_name}
|
|
|
|
|
|
|
|
DESTINATION ${_dest}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endmacro( )
|
|
|
|
endmacro( )
|
|
|
|
|
|
|
|
|
|
|
|