mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #27868 -- Filtered locale path subdirectories
Thanks Tim Graham for the review.
This commit is contained in:
@@ -604,6 +604,7 @@ class KeepPotFileExtractorTests(ExtractorTests):
|
||||
class MultipleLocaleExtractionTests(ExtractorTests):
|
||||
PO_FILE_PT = 'locale/pt/LC_MESSAGES/django.po'
|
||||
PO_FILE_DE = 'locale/de/LC_MESSAGES/django.po'
|
||||
PO_FILE_KO = 'locale/ko/LC_MESSAGES/django.po'
|
||||
LOCALES = ['pt', 'de', 'ch']
|
||||
|
||||
def test_multiple_locales(self):
|
||||
@@ -611,6 +612,18 @@ class MultipleLocaleExtractionTests(ExtractorTests):
|
||||
self.assertTrue(os.path.exists(self.PO_FILE_PT))
|
||||
self.assertTrue(os.path.exists(self.PO_FILE_DE))
|
||||
|
||||
def test_all_locales(self):
|
||||
"""
|
||||
When the `locale` flag is absent, all dirs from the parent locale dir
|
||||
are considered as language directories, except if the directory doesn't
|
||||
start with two letters (which excludes __pycache__, .gitignore, etc.).
|
||||
"""
|
||||
os.mkdir(os.path.join('locale', '_do_not_pick'))
|
||||
# Excluding locales that do not compile
|
||||
management.call_command('makemessages', exclude=['ja', 'es_AR'], verbosity=0)
|
||||
self.assertTrue(os.path.exists(self.PO_FILE_KO))
|
||||
self.assertFalse(os.path.exists('locale/_do_not_pick/LC_MESSAGES/django.po'))
|
||||
|
||||
|
||||
class ExcludedLocaleExtractionTests(ExtractorTests):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user