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:
|
if locale_dir is NO_LOCALE_DIR:
|
||||||
file_path = os.path.normpath(build_files[0].path)
|
file_path = os.path.normpath(build_files[0].path)
|
||||||
raise CommandError(
|
raise CommandError(
|
||||||
'Unable to find a locale path to store translations for '
|
"Unable to find a locale path to store translations for "
|
||||||
'file %s' % file_path
|
"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:
|
for build_file in build_files:
|
||||||
msgs = build_file.postprocess_messages(msgs)
|
msgs = build_file.postprocess_messages(msgs)
|
||||||
|
|
|
@ -758,9 +758,13 @@ class CustomLayoutExtractionTests(ExtractorTests):
|
||||||
work_subdir = 'project_dir'
|
work_subdir = 'project_dir'
|
||||||
|
|
||||||
def test_no_locale_raises(self):
|
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):
|
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):
|
def test_project_locale_paths(self):
|
||||||
self._test_project_locale_paths(os.path.join(self.test_dir, 'project_locale'))
|
self._test_project_locale_paths(os.path.join(self.test_dir, 'project_locale'))
|
||||||
|
|
Loading…
Reference in New Issue