summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-01-13 04:10:35 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-01-13 04:10:35 +0100
commit5c096137117e69dfcb8cd5a0c4432ffa93d4cbc9 (patch)
tree686db758350b1f002323b3041c7e9cf3053cfe20
parent6f9d42cd992ded747ffdc1cf407460e5136491fc (diff)
downloadtde-cmake-5c096137117e69dfcb8cd5a0c4432ffa93d4cbc9.tar.gz
tde-cmake-5c096137117e69dfcb8cd5a0c4432ffa93d4cbc9.zip
Update TDEL10n module
+ Add ability to skip the contents of selected <property> tags. + Fixed incorrect processing of the unpaired tags. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--modules/TDEL10n.cmake61
1 files changed, 45 insertions, 16 deletions
diff --git a/modules/TDEL10n.cmake b/modules/TDEL10n.cmake
index 1038df4..0ddea20 100644
--- a/modules/TDEL10n.cmake
+++ b/modules/TDEL10n.cmake
@@ -688,6 +688,7 @@ function( tde_l10n_prepare_xml )
unset( _source )
unset( _target )
unset( _context )
+ set( _skip_properties "database|associations|populationText" )
set( _tags "[tT][eE][xX][tT]|title|string|whatsthis|tooltip|label" )
set( _preserve "line-wrap" "lines-leading" "spaces-leading" "spaces-trailing" "spaces-multi" )
set( _no_c_format 1 )
@@ -717,6 +718,13 @@ function( tde_l10n_prepare_xml )
set( _directive 1 )
endif( )
+ # found directive "SKIP-PROPERTIES"
+ if( "+${_arg}" STREQUAL "+SKIP-PROPERTIES" )
+ unset( _skip_properties )
+ set( _var _skip_properties )
+ set( _directive 1 )
+ endif( )
+
# found directive "TAGS"
if( "+${_arg}" STREQUAL "+TAGS" )
unset( _tags )
@@ -768,6 +776,13 @@ function( tde_l10n_prepare_xml )
# prepare tags to regexp
string( REPLACE ";" "|" _tags "${_tags}" )
+ if( "${_skip_properties}" STREQUAL "-" )
+ unset( _skip_properties )
+ endif( )
+ if( DEFINED _skip_properties )
+ string( REPLACE ";" "|" _skip_properties "${_skip_properties}" )
+ set( _tags "property|${_tags}" )
+ endif( )
# read file
file( READ ${_source} _xml_data )
@@ -779,6 +794,7 @@ function( tde_l10n_prepare_xml )
unset( _xml_l10n )
unset( _xml_inside )
unset( _xml_tag_empty )
+ unset( _xml_skipped_prop )
while( _xml_pos LESS ${_xml_len} )
# pick line
string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _xml_line "${_xml_data}" )
@@ -793,23 +809,36 @@ function( tde_l10n_prepare_xml )
unset( _xml_line_suffix )
unset( _xml_line_rest )
if( NOT _xml_inside )
- if( "${_xml_line}" MATCHES "<(${_tags})[^>]*>" )
- set( _xml_inside 1 )
- set( _xml_context "${_context}" )
- string( REGEX MATCH "<(${_tags})[^>]*>(.*)" _xml_line "${_xml_line}" )
- string( REGEX MATCH "^<(${_tags})( [^>]*)+>" _xml_attr "${_xml_line}" )
- if( _xml_attr AND "${_xml_attr}" MATCHES " context=\"([^\"]*)\"" )
- string( REGEX REPLACE ".* context=\"([^\"]*)\".*" "\\1" _xml_context "${_xml_attr}" )
- endif( )
- string( REGEX REPLACE "^<(${_tags})[^>]*>(.*)" "\\2" _xml_line "${_xml_line}" )
- set( _xml_line_prefix "i18n(" )
- if( _no_c_format )
- set( _xml_line_prefix "${_xml_line_prefix}/* xgettext: no-c-format */" )
- endif( )
- if( _xml_context )
- set( _xml_line_prefix "${_xml_line_prefix}\"${_xml_context}\", " )
+ if( _xml_skipped_prop AND "${_xml_line}" MATCHES "</property>" )
+ unset( _xml_skipped_prop )
+ string( REGEX MATCH "</property>(.*)" _xml_line "${_xml_line}" )
+ string( REGEX REPLACE "^</property>(.*)" "\\1" _xml_line "${_xml_line}" )
+ endif( )
+ if( NOT _xml_skipped_prop AND "${_xml_line}" MATCHES "<(${_tags})([ \t][^>]*)*>" )
+ string( REGEX MATCH "<(${_tags})([ \t][^>]*)*>(.*)" _xml_line "${_xml_line}" )
+ string( REGEX MATCH "^<(${_tags})([ \t][^>]*)*>" _xml_attr "${_xml_line}" )
+ string( REGEX REPLACE "^<(${_tags})([ \t][^>]*)*>(.*)" "\\3" _xml_line "${_xml_line}" )
+ if( "${_xml_attr}" MATCHES "^<property([ \t][^>]*)*>" AND DEFINED _skip_properties )
+ if( "${_xml_attr}" MATCHES "[ \t]name=\"(${_skip_properties})\"" )
+ set( _xml_skipped_prop 1 )
+ endif( )
+ set( _xml_line_rest "${_xml_line}" )
+ set( _xml_line "" )
+ else( )
+ set( _xml_inside 1 )
+ set( _xml_context "${_context}" )
+ if( "${_xml_attr}" MATCHES "[ \t]context=\"([^\"]*)\"" )
+ string( REGEX REPLACE ".* context=\"([^\"]*)\".*" "\\1" _xml_context "${_xml_attr}" )
+ endif( )
+ set( _xml_line_prefix "i18n(" )
+ if( _no_c_format )
+ set( _xml_line_prefix "${_xml_line_prefix}/* xgettext: no-c-format */" )
+ endif( )
+ if( _xml_context )
+ set( _xml_line_prefix "${_xml_line_prefix}\"${_xml_context}\", " )
+ endif( )
+ set( _xml_tag_empty 1 )
endif( )
- set( _xml_tag_empty 1 )
else( )
set( _xml_line "" )
endif( )