[PATCH 8 of 9] i18n: leave out entries which contain only rst syntax

Simon Heimberg simohe at besonet.ch
Mon Feb 3 15:00:28 CST 2014


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1391459653 -3600
#      Mon Feb 03 21:34:13 2014 +0100
# Branch stable
# Node ID 9b735c20a211d61710fb93cb1e6cd899b21cfa4a
# Parent  b528ab92f005d4ff3b0a8004bf13fc308966cd98
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

diff -r b528ab92f005 -r 9b735c20a211 i18n/posplit
--- a/i18n/posplit	Wed Jan 29 16:57:00 2014 +0100
+++ b/i18n/posplit	Mon Feb 03 21:34:13 2014 +0100
@@ -59,6 +59,14 @@
                         # only directive, nothing to translate here
                         continue
                     directive = mdirective.group(1)
+                    if directive in ('container', 'include'):
+                        if msgid.rstrip('\n').count('\n') == 0:
+                            # only rst syntax, nothing to translate
+                            continue
+                        else:
+                            # lines following directly, unexpected
+                            print 'Warning: text follows line with directive' \
+                                  ' %s' % directive
                     comment = 'do not translate: .. %s::' % directive
                     if not newentry.comment:
                         newentry.comment = comment


More information about the Mercurial-devel mailing list