summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-12-09 12:15:44 +0100
committerSlávek Banko <slavek.banko@axis.cz>2018-12-09 12:48:16 +0100
commite66f00401fc3b78e77197f3fa37b72a145a93d2e (patch)
treef9f558d266d316407c5b2d3cc67d0926caf68c44
parent45cfe22ac89a078e524afc2311be96724d727db3 (diff)
downloadtde-cmake-e66f0040.tar.gz
tde-cmake-e66f0040.zip
Update TDEL10n module
+ Added ability to merge additional template. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--modules/TDEL10n.cmake41
1 files changed, 38 insertions, 3 deletions
diff --git a/modules/TDEL10n.cmake b/modules/TDEL10n.cmake
index 8ab4a7a..8c2caf8 100644
--- a/modules/TDEL10n.cmake
+++ b/modules/TDEL10n.cmake
@@ -83,6 +83,16 @@ if( NOT DEFINED MSGUNIQ_EXECUTABLE )
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( _rcs )
unset( _desktops )
+ unset( _pots )
unset( _dest )
unset( _keywords )
unset( _attributes )
@@ -399,6 +410,14 @@ macro( tde_l10n_create_template )
endif( )
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
if( _files )
execute_process(
@@ -439,9 +458,10 @@ macro( tde_l10n_create_template )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} )
file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_potDesktop} )
execute_process(
- COMMAND ${MSGUNIQ_EXECUTABLE}
- INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp
- OUTPUT_VARIABLE _pot
+ COMMAND ${MSGUNIQ_EXECUTABLE} --use-first
+ INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE _pot
)
file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp )
else( )
@@ -454,6 +474,21 @@ macro( tde_l10n_create_template )
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
if( _pot )