summaryrefslogtreecommitdiff
path: root/itstool.in
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2011-06-29 21:15:46 +0200
committerClaude Paroz <claude@2xlibre.net>2011-06-29 21:15:46 +0200
commit6411b09431eb72ed5426d40a0142e7479c486d3b (patch)
tree544b9412dc9d16d3195b7843968ed661c4c624c9 /itstool.in
parent187fcbe585560f128c7436e66f6b8e3a789a73b0 (diff)
downloaditstool-6411b09431eb72ed5426d40a0142e7479c486d3b.tar.gz
Fix placeholder translation when it contains sub-elements
Diffstat (limited to 'itstool.in')
-rwxr-xr-xitstool.in12
1 files changed, 10 insertions, 2 deletions
diff --git a/itstool.in b/itstool.in
index 2401918..1db369c 100755
--- a/itstool.in
+++ b/itstool.in
@@ -692,8 +692,13 @@ class Document (object):
if child.type != 'element':
continue
if child.ns() is not None and child.ns().content == NS_BLANK:
- repl = self.get_translated(msg.get_placeholder(child.name).node, translations)
- child.replaceNode(repl)
+ ph_node = msg.get_placeholder(child.name).node
+ if self.has_child_elements(ph_node):
+ self.merge_translations(translations, None, ph_node)
+ child.replaceNode(ph_node)
+ else:
+ repl = self.get_translated(ph_node, translations)
+ child.replaceNode(repl)
scan_node(child)
scan_node(trnode)
retnode = node.copyNode(2)
@@ -802,6 +807,9 @@ class Document (object):
def is_translation_unit (self, node):
return self.get_its_within_text(node) != 'yes'
+ def has_child_elements(self, node):
+ return len([child for child in xml_child_iter(node) if child.type=='element'])
+
def get_preserve_space (self, node):
if node.getSpacePreserve() == 1:
return True