Update TDEL10n module

+ Added ability to merge additional template.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit e66f00401f)
v3.5.13-sru
Slávek Banko 6 years ago
parent c741b657de
commit 1db4baf7c7
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -83,6 +83,16 @@ if( NOT DEFINED MSGUNIQ_EXECUTABLE )
endif( ) endif( )
endif( ) endif( )
if( NOT DEFINED MSGCAT_EXECUTABLE )
find_program( MSGCAT_EXECUTABLE
NAMES msgcat
HINTS "${TDE_PREFIX}/bin"
)
if( NOT MSGCAT_EXECUTABLE )
tde_message_fatal( "msgcat is required but not found" )
endif( )
endif( )
################################################# #################################################
##### #####
@ -173,6 +183,7 @@ macro( tde_l10n_create_template )
unset( _files ) unset( _files )
unset( _rcs ) unset( _rcs )
unset( _desktops ) unset( _desktops )
unset( _pots )
unset( _dest ) unset( _dest )
unset( _keywords ) unset( _keywords )
unset( _attributes ) unset( _attributes )
@ -399,6 +410,14 @@ macro( tde_l10n_create_template )
endif( ) endif( )
endforeach( ) endforeach( )
# pick pot files *.pot
foreach( _src ${_files} )
if( ${_src} MATCHES "\\.pot(\\.cmake)?(\\.tde_l10n)?$" )
list( APPEND _pots ${_src} )
list( REMOVE_ITEM _files ${_src} )
endif( )
endforeach( )
# create translation template # create translation template
if( _files ) if( _files )
execute_process( execute_process(
@ -439,8 +458,9 @@ macro( tde_l10n_create_template )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} ) file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} )
file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_potDesktop} ) file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_potDesktop} )
execute_process( execute_process(
COMMAND ${MSGUNIQ_EXECUTABLE} COMMAND ${MSGUNIQ_EXECUTABLE} --use-first
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _pot OUTPUT_VARIABLE _pot
) )
file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ) file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp )
@ -454,6 +474,21 @@ macro( tde_l10n_create_template )
endif( ) endif( )
endif( ) endif( )
# merge additional pot files
if( _pots )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} )
execute_process(
COMMAND ${MSGCAT_EXECUTABLE} --use-first extracted-pot.tmp ${_pots}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _pot
)
file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp )
# set charset and encoding headers
string( REPLACE "Content-Type: text/plain charset=CHARSET" "Content-Type: text/plain charset=UTF-8" _pot ${_pot} )
string( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot ${_pot} )
endif( )
# finalize translation template # finalize translation template
if( _pot ) if( _pot )

Loading…
Cancel
Save