summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@redhat.com>2016-03-14 14:03:33 -0400
committerShaun McCance <shaunm@redhat.com>2016-03-14 14:03:33 -0400
commita5f19fe2bd851f44216840bb2d63581006967e6f (patch)
treecca6e38fff68f7568ce2dfc862e6738247ddf274
parent359be5c350fc3d869807f663cee2b028adf1f5d7 (diff)
downloaditstool-a5f19fe2bd851f44216840bb2d63581006967e6f.tar.gz
Don't error out (except under -s) for mismatched placeholders
-rwxr-xr-xitstool.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/itstool.in b/itstool.in
index d0e76a1..ff9a1bd 100755
--- a/itstool.in
+++ b/itstool.in
@@ -1033,7 +1033,17 @@ class Document (object):
repl = self.get_translated(ph_node, translations, strict=strict, lang=lang)
child.replaceNode(repl)
scan_node(child)
- scan_node(trnode)
+ try:
+ scan_node(trnode)
+ except:
+ if strict:
+ raise
+ else:
+ sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
+ (lang + ' ') if lang is not None else '',
+ msgstr.encode('utf-8')))
+ self._xml_err = ''
+ return node
retnode = node.copyNode(2)
for child in xml_child_iter(trnode):
retnode.addChild(child.copyNode(1))