mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #7050 - Allow the makemessages command to optionally ignore paths when examining source code and templates for translation strings.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -28,6 +28,9 @@ class ExtractorTests(TestCase):
|
||||
def assertMsgId(self, msgid, s):
|
||||
return self.assert_(re.search('^msgid "%s"' % msgid, s, re.MULTILINE))
|
||||
|
||||
def assertNotMsgId(self, msgid, s):
|
||||
return self.assert_(not re.search('^msgid "%s"' % msgid, s, re.MULTILINE))
|
||||
|
||||
|
||||
class JavascriptExtractorTests(ExtractorTests):
|
||||
|
||||
@@ -41,6 +44,20 @@ class JavascriptExtractorTests(ExtractorTests):
|
||||
self.assertMsgId('This literal should be included.', po_contents)
|
||||
self.assertMsgId('This one as well.', po_contents)
|
||||
|
||||
|
||||
class IgnoredExtractorTests(ExtractorTests):
|
||||
|
||||
PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE
|
||||
|
||||
def test_ignore_option(self):
|
||||
os.chdir(self.test_dir)
|
||||
management.call_command('makemessages', locale=LOCALE, verbosity=0, ignore_patterns=['ignore_dir/*'])
|
||||
self.assert_(os.path.exists(self.PO_FILE))
|
||||
po_contents = open(self.PO_FILE, 'r').read()
|
||||
self.assertMsgId('This literal should be included.', po_contents)
|
||||
self.assertNotMsgId('This should be ignored.', po_contents)
|
||||
|
||||
|
||||
class SymlinkExtractorTests(ExtractorTests):
|
||||
|
||||
PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE
|
||||
|
||||
Reference in New Issue
Block a user