mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
i18n: added a way to merge in some more locale paths via settings
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9e1640c55f
commit
d606cf7e38
@ -119,6 +119,16 @@ def translation(appname, language):
|
||||
except IOError: t = gettext_module.NullTranslations()
|
||||
_translations[(appname, language)] = t
|
||||
|
||||
if hasattr(settings, 'LOCALE_PATHS'):
|
||||
for localepath in settings.LOCALE_PATHS:
|
||||
try:
|
||||
t = gettext_module.translation('django', localepath, [language, settings.LANGUAGE_CODE], klass)
|
||||
t.set_app_and_language(appname, language)
|
||||
except IOError: t = None
|
||||
if t is not None:
|
||||
t.add_fallback(_translations[(appname, language)])
|
||||
_translations[(appname, language)] = t
|
||||
|
||||
parts = os.environ['DJANGO_SETTINGS_MODULE'].split('.')
|
||||
project = __import__(parts[0], {}, {}, [])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user