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".
This commit is contained in:
FUJIWARA Katsunori 2016-02-11 23:15:34 +09:00
parent e072959d9e
commit 5a05b076f2

View File

@ -57,11 +57,13 @@ if __name__ == "__main__":
if mdirective:
if not msgid[mdirective.end():].rstrip():
# only directive, nothing to translate here
delta += 2
continue
directive = mdirective.group(1)
if directive in ('container', 'include'):
if msgid.rstrip('\n').count('\n') == 0:
# only rst syntax, nothing to translate
delta += 2
continue
else:
# lines following directly, unexpected