Ticket #19552: 19552.diff

File 19552.diff, 3.0 KB (added by Claude Paroz, 12 years ago)
  • django/utils/translation/trans_real.py

    diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
    index cf6270c..f8d6d81 100644
    a b def templatize(src, origin=None):  
    586586                    else:
    587587                        out.write(blankout(p, 'F'))
    588588            elif t.token_type == TOKEN_COMMENT:
    589                 out.write(' # %s' % t.contents)
     589                out.write(' # %s\n' % t.contents)
    590590            else:
    591591                out.write(blankout(t.contents, 'X'))
    592592    return force_str(out.getvalue())
  • tests/regressiontests/i18n/commands/extraction.py

    diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
    index aa5efe1..2f1fbd0 100644
    a b class BasicExtractorTests(ExtractorTests):  
    6262            self.assertTrue('#. Translators: This comment should be extracted' in po_contents)
    6363            self.assertTrue('This comment should not be extracted' not in po_contents)
    6464            # Comments in templates
     65            # The comment on the same line shouldn't mask the translatable string
     66            self.assertTrue('msgid "Translatable literal #0"' in po_contents)
     67
    6568            self.assertTrue('#. Translators: Django template comment for translators' in po_contents)
    6669            self.assertTrue("#. Translators: Django comment block for translators\n#. string's meaning unveiled" in po_contents)
    6770
    class NoLocationExtractorTests(ExtractorTests):  
    284287        self.assertTrue(os.path.exists(self.PO_FILE))
    285288        with open(self.PO_FILE, 'r') as fp:
    286289            po_contents = force_text(fp.read())
    287             self.assertFalse('#: templates/test.html:55' in po_contents)
     290            self.assertFalse('#: templates/test.html:56' in po_contents)
    288291
    289292    def test_no_location_disabled(self):
    290293        os.chdir(self.test_dir)
    class NoLocationExtractorTests(ExtractorTests):  
    292295        self.assertTrue(os.path.exists(self.PO_FILE))
    293296        with open(self.PO_FILE, 'r') as fp:
    294297            po_contents = force_text(fp.read())
    295             self.assertTrue('#: templates/test.html:55' in po_contents)
     298            self.assertTrue('#: templates/test.html:56' in po_contents)
  • tests/regressiontests/i18n/commands/templates/test.html

    diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html
    index e7d7f3c..7d78bd8 100644
    a b string's meaning unveiled  
    99<p>{% blocktrans %}I think that 100% is more that 50% of anything.{% endblocktrans %}</p>
    1010{% blocktrans with 'txt' as obj %}I think that 100% is more that 50% of {{ obj }}.{% endblocktrans %}
    1111
     12{# Translators: comment on same line #}{% trans "Translatable literal #0" %}
     13
    1214{% comment %}Some random comment
    1315Some random comment
    1416Translators: One-line translator comment #1
Back to Top