|
|
@ -12,10 +12,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
##### include essential TDE macros ##############
|
|
|
|
##### include essential TDE macros ##############
|
|
|
|
|
|
|
|
|
|
|
|
if( NOT DEFINED MASTER_SOURCE_DIR )
|
|
|
|
set( MASTER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
|
|
|
|
set( MASTER_SOURCE_DIR "${CMAKE_SOURCE_DIR}" )
|
|
|
|
include( TDEMacros )
|
|
|
|
include( TDEMacros )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##### verify required programs ##################
|
|
|
|
##### verify required programs ##################
|
|
|
@ -154,6 +152,11 @@ endfunction( )
|
|
|
|
##### ATTRIBUTES determines files and specification for extractattr:
|
|
|
|
##### ATTRIBUTES determines files and specification for extractattr:
|
|
|
|
##### source_spec:element,attribute[,context]
|
|
|
|
##### source_spec:element,attribute[,context]
|
|
|
|
##### DESTINATION determines directory to save translation template.
|
|
|
|
##### DESTINATION determines directory to save translation template.
|
|
|
|
|
|
|
|
##### The destination directory is determined as follows:
|
|
|
|
|
|
|
|
##### a) Directory is specified as an argument.
|
|
|
|
|
|
|
|
##### b) The variable POT_SOURCE_DIR is set.
|
|
|
|
|
|
|
|
##### c) There is a 'translations' directory.
|
|
|
|
|
|
|
|
##### d) There is a 'po' directory.
|
|
|
|
#####
|
|
|
|
#####
|
|
|
|
##### Note:
|
|
|
|
##### Note:
|
|
|
|
##### Editing the _files list inside foreach( ${_files} ) below in the
|
|
|
|
##### Editing the _files list inside foreach( ${_files} ) below in the
|
|
|
@ -234,11 +237,27 @@ macro( tde_l10n_create_template )
|
|
|
|
if( NOT _catalog )
|
|
|
|
if( NOT _catalog )
|
|
|
|
tde_message_fatal( "the name of the translation catalog is not defined" )
|
|
|
|
tde_message_fatal( "the name of the translation catalog is not defined" )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# determine the destination directory
|
|
|
|
|
|
|
|
if( NOT _dest )
|
|
|
|
|
|
|
|
if( POT_SOURCE_DIR )
|
|
|
|
|
|
|
|
set( _dest ${POT_SOURCE_DIR} )
|
|
|
|
|
|
|
|
elseif( EXISTS "${MASTER_SOURCE_DIR}/translations" )
|
|
|
|
|
|
|
|
set( _dest "${MASTER_SOURCE_DIR}/translations/" )
|
|
|
|
|
|
|
|
elseif( EXISTS "${MASTER_SOURCE_DIR}/po" )
|
|
|
|
|
|
|
|
set( _dest "${MASTER_SOURCE_DIR}/po/" )
|
|
|
|
|
|
|
|
else( )
|
|
|
|
|
|
|
|
tde_message_fatal( "cannot determine destination directory" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
if( ${_dest} MATCHES "[^/]$" )
|
|
|
|
if( ${_dest} MATCHES "[^/]$" )
|
|
|
|
set( _dest "${_dest}/" )
|
|
|
|
set( _dest "${_dest}/" )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
if( ${_dest} MATCHES "^[^/]" )
|
|
|
|
|
|
|
|
set( _dest "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}" )
|
|
|
|
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
get_filename_component( _potFilename "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" ABSOLUTE )
|
|
|
|
get_filename_component( _potFilename "${_dest}${_catalog}.pot" ABSOLUTE )
|
|
|
|
file( RELATIVE_PATH _potFilename ${CMAKE_SOURCE_DIR} ${_potFilename} )
|
|
|
|
file( RELATIVE_PATH _potFilename ${CMAKE_SOURCE_DIR} ${_potFilename} )
|
|
|
|
message( STATUS "Create translation template ${_potFilename}" )
|
|
|
|
message( STATUS "Create translation template ${_potFilename}" )
|
|
|
|
|
|
|
|
|
|
|
@ -462,8 +481,8 @@ macro( tde_l10n_create_template )
|
|
|
|
string( REGEX REPLACE "\\.tde_l10n(:[0-9]+)" "\\1" _pot ${_pot} )
|
|
|
|
string( REGEX REPLACE "\\.tde_l10n(:[0-9]+)" "\\1" _pot ${_pot} )
|
|
|
|
|
|
|
|
|
|
|
|
# save translation template
|
|
|
|
# save translation template
|
|
|
|
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" )
|
|
|
|
if( EXISTS "${_dest}${_catalog}.pot" )
|
|
|
|
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" _potOrig )
|
|
|
|
file( READ "${_dest}${_catalog}.pot" _potOrig )
|
|
|
|
else( )
|
|
|
|
else( )
|
|
|
|
unset( _potOrig )
|
|
|
|
unset( _potOrig )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
@ -472,7 +491,7 @@ macro( tde_l10n_create_template )
|
|
|
|
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potNew ${_pot} )
|
|
|
|
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potNew ${_pot} )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
if( NOT _potOrig OR NOT "${_potNew}" STREQUAL "${_potOrig}" )
|
|
|
|
if( NOT _potOrig OR NOT "${_potNew}" STREQUAL "${_potOrig}" )
|
|
|
|
file( WRITE "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" ${_pot} )
|
|
|
|
file( WRITE "${_dest}${_catalog}.pot" ${_pot} )
|
|
|
|
endif( )
|
|
|
|
endif( )
|
|
|
|
|
|
|
|
|
|
|
|
endif( _pot )
|
|
|
|
endif( _pot )
|
|
|
|