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

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 3, 2014, 9 p.m.
Message ID <9b735c20a211d61710fb.1391461228@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3448/
State Accepted
Commit e3ee7ec85a15831780985fce73b9545f00c2dac1
Headers show

Comments

Simon Heimberg - Feb. 3, 2014, 9 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@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

Patch

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