summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-12-08 15:50:22 +0100
committerSlávek Banko <slavek.banko@axis.cz>2018-12-08 18:32:01 +0100
commit1f90129fec23b4521c7b65c492d1e9cf9c35ca78 (patch)
treec2e8f8dc561bec46a78ef25c9f208fa0c3cde1b6 /modules
parent13a14899d50fbb99601cd0e83ae0d20ab46a404d (diff)
downloadtde-cmake-1f90129fec23b4521c7b65c492d1e9cf9c35ca78.tar.gz
tde-cmake-1f90129fec23b4521c7b65c492d1e9cf9c35ca78.zip
Update TDEL10n module
+ Input files with the extension ".tde_l10n" are considered as temporary modified source files. + Location information for such files in generated POT file will be modified to refer to the corresponding original files without the extension ".tde_l10n". + After the POT file is generated, these temporary modified source files will be automatically deleted. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'modules')
-rw-r--r--modules/TDEL10n.cmake29
1 files changed, 17 insertions, 12 deletions
diff --git a/modules/TDEL10n.cmake b/modules/TDEL10n.cmake
index 084e8f9..eebc1ec 100644
--- a/modules/TDEL10n.cmake
+++ b/modules/TDEL10n.cmake
@@ -300,16 +300,16 @@ macro( tde_create_l10n_template )
# pick resource files *.kcfg, *.rc and *.ui
foreach( _src ${_files} )
- if( ${_src} MATCHES "\\.(kcfg|rc|ui)(\\.cmake)?$" )
+ if( ${_src} MATCHES "\\.(kcfg|rc|ui)(\\.cmake)?(\\.tde_l10n)?$" )
list( APPEND _rcs ${_src} )
list( REMOVE_ITEM _files ${_src} )
endif( )
endforeach( )
- # prepare extracted-rc.cpp
+ # prepare extracted-rc.tde_l10n
if( _rcs OR _attributes )
- file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.cpp "" )
- list( APPEND _files extracted-rc.cpp )
+ file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n "" )
+ list( APPEND _files extracted-rc.tde_l10n )
endif( )
# process resource files
@@ -319,7 +319,7 @@ macro( tde_create_l10n_template )
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _sources_rc
)
- file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.cpp ${_sources_rc} )
+ file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n ${_sources_rc} )
endif( )
# extract attributes
@@ -340,7 +340,7 @@ macro( tde_create_l10n_template )
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _attrib_rc
)
- file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.cpp ${_attrib_rc} )
+ file( APPEND ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n ${_attrib_rc} )
endif( )
endif( )
endforeach( )
@@ -348,7 +348,7 @@ macro( tde_create_l10n_template )
# pick desktop files *.desktop and *.protocol
foreach( _src ${_files} )
- if( ${_src} MATCHES "\\.(desktop|protocol)(\\.cmake)?$" )
+ if( ${_src} MATCHES "\\.(desktop|protocol)(\\.cmake)?(\\.tde_l10n)?$" )
list( APPEND _desktops ${_src} )
list( REMOVE_ITEM _files ${_src} )
endif( )
@@ -414,7 +414,7 @@ macro( tde_create_l10n_template )
# update references for resources to original files and line numbers
if( _rcs OR _attributes )
- file( STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.cpp" _extractedRC )
+ file( STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n" _extractedRC )
list( LENGTH _extractedRC _extractedRC_len )
set( _rcPos 0 )
while( _rcPos LESS ${_extractedRC_len} )
@@ -424,12 +424,15 @@ macro( tde_create_l10n_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.cpp:${_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} )
+
# save translation template
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" )
file( READ "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}${_catalog}.pot" _potOrig )
@@ -447,8 +450,10 @@ macro( tde_create_l10n_template )
endif( _pot )
# cleanup
- if( _rcs OR _attributes )
- file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.cpp )
- endif( )
+ foreach( _file ${_files} ${_rsc} ${_desktops} )
+ if( "${_file}" MATCHES "\\.tde_l10n$" )
+ file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/${_file} )
+ endif( )
+ endforeach( )
endmacro( )