comparison i18n/posplit @ 28074:a1924bc6e267

i18n: calculate correct line number in source of messages to be translated Before this patch, line number in source of the message to be translated is wrong in hg.pot, if corresponded message is placed after ".. DIRECTIVE::", because number of lines related to such directive isn't added to variable "delta", which holds number of untranslated lines in given text. This patch always adds "2" to "delta", because text block is split into translation units by "\n\n".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 11 Feb 2016 23:15:34 +0900
parents e3ee7ec85a15
children c5057b7780dc
comparison
equal deleted inserted replaced
28073:c4bec3c45ec9 28074:a1924bc6e267
55 newentry = mkentry(entry, delta, msgid, msgstr) 55 newentry = mkentry(entry, delta, msgid, msgstr)
56 mdirective = findd.match(msgid) 56 mdirective = findd.match(msgid)
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 delta += 2
60 continue 61 continue
61 directive = mdirective.group(1) 62 directive = mdirective.group(1)
62 if directive in ('container', 'include'): 63 if directive in ('container', 'include'):
63 if msgid.rstrip('\n').count('\n') == 0: 64 if msgid.rstrip('\n').count('\n') == 0:
64 # only rst syntax, nothing to translate 65 # only rst syntax, nothing to translate
66 delta += 2
65 continue 67 continue
66 else: 68 else:
67 # lines following directly, unexpected 69 # lines following directly, unexpected
68 print 'Warning: text follows line with directive' \ 70 print 'Warning: text follows line with directive' \
69 ' %s' % directive 71 ' %s' % directive