Ticket #10004: comment-extraction-2.patch
File comment-extraction-2.patch, 2.9 KB (added by , 14 years ago) |
---|
-
django/core/management/commands/makemessages.py
196 196 'xgettext -d %s -L Perl %s --keyword=gettext_noop ' 197 197 '--keyword=gettext_lazy --keyword=ngettext_lazy:1,2 ' 198 198 '--keyword=pgettext:1c,2 --keyword=npgettext:1c,2,3 ' 199 '--from-code UTF-8 - o - "%s"' % (199 '--from-code UTF-8 --add-comments=L10n -o - "%s"' % ( 200 200 domain, wrap, os.path.join(dirpath, thefile) 201 201 ) 202 202 ) … … 240 240 '--keyword=ugettext_noop --keyword=ugettext_lazy ' 241 241 '--keyword=ungettext_lazy:1,2 --keyword=pgettext:1c,2 ' 242 242 '--keyword=npgettext:1c,2,3 --keyword=pgettext_lazy:1c,2 ' 243 '--keyword=npgettext_lazy:1c,2,3 --from-code UTF-8 -o - ' 244 '"%s"' % (domain, wrap, os.path.join(dirpath, thefile)) 243 '--keyword=npgettext_lazy:1c,2,3 --from-code UTF-8 ' 244 '--add-comments=L10n -o - "%s"' % ( 245 domain, wrap, os.path.join(dirpath, thefile)) 245 246 ) 246 247 msgs, errors = _popen(cmd) 247 248 if errors: -
tests/regressiontests/i18n/commands/__init__.py
1 from django.utils.translation import ugettext as _ 2 3 # L10n: This comment should be extracted 4 dummy1 = _("This is a translatable string.") 5 6 # This comment should not be extracted 7 dummy2 = _("This is another translatable string.") 8 -
tests/regressiontests/i18n/commands/extraction.py
38 38 return self.assert_(not re.search('^msgid %s' % msgid, s, re.MULTILINE)) 39 39 40 40 41 class TemplateExtractorTests(ExtractorTests):41 class BasicExtractorTests(ExtractorTests): 42 42 43 def test_comments_extractor(self): 44 os.chdir(self.test_dir) 45 management.call_command('makemessages', locale=LOCALE, verbosity=0) 46 self.assert_(os.path.exists(self.PO_FILE)) 47 po_contents = open(self.PO_FILE, 'r').read() 48 self.assert_('#. L10n: This comment should be extracted' in po_contents) 49 self.assert_('This comment should not be extracted' not in po_contents) 50 43 51 def test_templatize(self): 44 52 os.chdir(self.test_dir) 45 53 management.call_command('makemessages', locale=LOCALE, verbosity=0)