diff --git a/django/bin/compile-messages.py b/django/bin/compile-messages.py index 8693022644..0d71413e5a 100755 --- a/django/bin/compile-messages.py +++ b/django/bin/compile-messages.py @@ -11,11 +11,10 @@ except NameError: def compile_messages(locale=None): - basedirs = [os.path.join('conf', 'locale'), 'locale'] + basedirs = (os.path.join('conf', 'locale'), 'locale') if os.environ.get('DJANGO_SETTINGS_MODULE'): from django.conf import settings - if hasattr(settings, 'LOCALE_PATHS'): - basedirs += settings.LOCALE_PATHS + basedirs += settings.LOCALE_PATHS # Gather existing directories. basedirs = set(map(os.path.abspath, filter(os.path.isdir, basedirs))) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 994e908caf..2853d6c618 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -90,6 +90,8 @@ LANGUAGES_BIDI = ("he", "ar", "fa") # to load the internationalization machinery. USE_I18N = True +LOCALE_PATHS = () + # Not-necessarily-technical managers of the site. They get broken link # notifications and other various e-mails. MANAGERS = ADMINS diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index c95c842a4f..a7259b3ce5 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -168,10 +168,9 @@ def translation(language): res.merge(t) return res - if hasattr(settings, 'LOCALE_PATHS'): - for localepath in settings.LOCALE_PATHS: - if os.path.isdir(localepath): - res = _merge(localepath) + for localepath in settings.LOCALE_PATHS: + if os.path.isdir(localepath): + res = _merge(localepath) if projectpath and os.path.isdir(projectpath): res = _merge(projectpath) diff --git a/docs/settings.txt b/docs/settings.txt index 6241749753..0219f9853a 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -583,7 +583,7 @@ LOCALE_PATHS Default: ``()`` (Empty tuple) -A list of directories where Django looks for translation files. +A tuple of directories where Django looks for translation files. See the `internationalization docs section`_ explaining the variable and the default behavior.