comparison i18n/posplit @ 20363:e3ee7ec85a15

i18n: leave out entries which contain only rst syntax This prevents the danger of translating entries like the following ones: .. container:: verbose .. input:: filename1.txt
author Simon Heimberg <simohe@besonet.ch>
date Mon, 03 Feb 2014 21:34:13 +0100
parents 1bce1078501d
children a1924bc6e267
comparison
equal deleted inserted replaced
20362:1bce1078501d 20363:e3ee7ec85a15
57 if mdirective: 57 if mdirective:
58 if not msgid[mdirective.end():].rstrip(): 58 if not msgid[mdirective.end():].rstrip():
59 # only directive, nothing to translate here 59 # only directive, nothing to translate here
60 continue 60 continue
61 directive = mdirective.group(1) 61 directive = mdirective.group(1)
62 if directive in ('container', 'include'):
63 if msgid.rstrip('\n').count('\n') == 0:
64 # only rst syntax, nothing to translate
65 continue
66 else:
67 # lines following directly, unexpected
68 print 'Warning: text follows line with directive' \
69 ' %s' % directive
62 comment = 'do not translate: .. %s::' % directive 70 comment = 'do not translate: .. %s::' % directive
63 if not newentry.comment: 71 if not newentry.comment:
64 newentry.comment = comment 72 newentry.comment = comment
65 elif comment not in newentry.comment: 73 elif comment not in newentry.comment:
66 newentry.comment += '\n' + comment 74 newentry.comment += '\n' + comment