Browse Source

Update TDEL10n module

+ Fix unwanted semicolons processing within CMake.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/8/head
Slávek Banko 4 years ago
parent
commit
b88855a293
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668
  1. 30
      modules/TDEL10n.cmake

30
modules/TDEL10n.cmake

@ -431,8 +431,8 @@ macro( tde_l10n_create_template )
# set charset and encoding headers
if( _pot )
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} )
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( )
endif( )
@ -455,8 +455,8 @@ macro( tde_l10n_create_template )
# merge translation templates
if( _potDesktop )
if( _pot )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} )
file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_potDesktop} )
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} --use-first
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp
@ -465,18 +465,18 @@ macro( tde_l10n_create_template )
)
file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp )
else( )
set( _pot ${_potDesktop} )
set( _pot "${_potDesktop}" )
# 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} )
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( )
endif( )
endif( )
# merge additional pot files
if( _pots )
file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ${_pot} )
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}
@ -485,8 +485,8 @@ macro( tde_l10n_create_template )
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} )
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
@ -506,14 +506,14 @@ macro( tde_l10n_create_template )
string( REGEX REPLACE "^//i18n: file (.*) line ([0-9]*)$" "\\1:\\2" _rcOrig ${_rcLine} )
endif( )
if( "${_rcLine}" MATCHES "^i18n\\(" AND _rcOrig )
string( REGEX REPLACE "(^|\n)(#:.*) extracted-rc.tde_l10n:${_rcPos}( |\n)" "\\1\\2 ${_rcOrig}\\3" _pot ${_pot} )
string( REGEX REPLACE "(^|\n)(#:.*) extracted-rc.tde_l10n:${_rcPos}( |\n)" "\\1\\2 ${_rcOrig}\\3" _pot "${_pot}" )
unset( _rcOrig )
endif( )
endwhile( )
endif( )
# update references for modified source files (".tde_l10n" extension)
string( REGEX REPLACE "\\.tde_l10n(:[0-9]+)" "\\1" _pot ${_pot} )
string( REGEX REPLACE "\\.tde_l10n(:[0-9]+)" "\\1" _pot "${_pot}" )
# save translation template
if( EXISTS "${_dest}${_catalog}.pot" )
@ -522,11 +522,11 @@ macro( tde_l10n_create_template )
unset( _potOrig )
endif( )
if( _potOrig )
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potOrig ${_potOrig} )
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potNew ${_pot} )
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potOrig "${_potOrig}" )
string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potNew "${_pot}" )
endif( )
if( NOT _potOrig OR NOT "${_potNew}" STREQUAL "${_potOrig}" )
file( WRITE "${_dest}${_catalog}.pot" ${_pot} )
file( WRITE "${_dest}${_catalog}.pot" "${_pot}" )
endif( )
endif( _pot )

Loading…
Cancel
Save