summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-12-13 01:16:54 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-01-09 01:44:03 +0100
commitc1f45d8f90f6c156b2d8db584337189436c1fe42 (patch)
treeaa6fe0877be7c0ecad5a94a9071bbe66e28f1e00 /modules
parent1c079078212fac30ebc5248d95664a7b4348504b (diff)
downloadtde-cmake-c1f45d8f90f6c156b2d8db584337189436c1fe42.tar.gz
tde-cmake-c1f45d8f90f6c156b2d8db584337189436c1fe42.zip
Update TDEL10n module
+ Add new options to function tde_l10n_prepare_xml -- override the context by using the tag attribute -- preserve / remove leading empty lines Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'modules')
-rw-r--r--modules/TDEL10n.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/TDEL10n.cmake b/modules/TDEL10n.cmake
index 2dfba00..acad61b 100644
--- a/modules/TDEL10n.cmake
+++ b/modules/TDEL10n.cmake
@@ -606,7 +606,7 @@ function( tde_l10n_prepare_xml )
unset( _target )
unset( _context )
set( _tags "[tT][eE][xX][tT]|title|string|whatsthis|tooltip|label" )
- set( _preserve "line-wrap" "spaces-leading" "spaces-trailing" "spaces-multi" )
+ set( _preserve "line-wrap" "lines-leading" "spaces-leading" "spaces-trailing" "spaces-multi" )
set( _no_c_format 1 )
unset( _directive )
set( _var _source )
@@ -712,14 +712,19 @@ function( tde_l10n_prepare_xml )
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( _context )
- set( _xml_line_prefix "${_xml_line_prefix}\"${_context}\", " )
+ if( _xml_context )
+ set( _xml_line_prefix "${_xml_line_prefix}\"${_xml_context}\", " )
endif( )
set( _xml_tag_empty 1 )
else( )
@@ -755,7 +760,10 @@ function( tde_l10n_prepare_xml )
if( _xml_inside )
if( ";${_preserve};" MATCHES ";line-wrap;" )
- set( _xml_line "${_xml_line}\\n" )
+ if( ";${_preserve};" MATCHES ";lines-leading;"
+ OR NOT "${_xml_line}" STREQUAL "" OR NOT _xml_tag_empty )
+ set( _xml_line "${_xml_line}\\n" )
+ endif( )
elseif( NOT "${_xml_line}" STREQUAL "" AND NOT _xml_tag_empty )
set( _xml_line " ${_xml_line}" )
endif( )