Fixed #32145 -- Improved makemessages error message when app's locale directory doesn't exist.
This commit is contained in:
parent
d4ac23bee1
commit
9c6ba87692
|
@ -583,8 +583,9 @@ class Command(BaseCommand):
|
|||
if locale_dir is NO_LOCALE_DIR:
|
||||
file_path = os.path.normpath(build_files[0].path)
|
||||
raise CommandError(
|
||||
'Unable to find a locale path to store translations for '
|
||||
'file %s' % file_path
|
||||
"Unable to find a locale path to store translations for "
|
||||
"file %s. Make sure the 'locale' directory exist in an "
|
||||
"app or LOCALE_PATHS setting is set." % file_path
|
||||
)
|
||||
for build_file in build_files:
|
||||
msgs = build_file.postprocess_messages(msgs)
|
||||
|
|
|
@ -758,9 +758,13 @@ class CustomLayoutExtractionTests(ExtractorTests):
|
|||
work_subdir = 'project_dir'
|
||||
|
||||
def test_no_locale_raises(self):
|
||||
msg = "Unable to find a locale path to store translations for file"
|
||||
msg = (
|
||||
"Unable to find a locale path to store translations for file "
|
||||
"__init__.py. Make sure the 'locale' directory exist in an app or "
|
||||
"LOCALE_PATHS setting is set."
|
||||
)
|
||||
with self.assertRaisesMessage(management.CommandError, msg):
|
||||
management.call_command('makemessages', locale=LOCALE, verbosity=0)
|
||||
management.call_command('makemessages', locale=[LOCALE], verbosity=0)
|
||||
|
||||
def test_project_locale_paths(self):
|
||||
self._test_project_locale_paths(os.path.join(self.test_dir, 'project_locale'))
|
||||
|
|
Loading…
Reference in New Issue