Don't merge in translations twice from deprecated project level tree when it is also listed in LOCALE_PATHS. Thanks Claude Paroz. Refs #14924.
Also, removed some old unused variables as reported by pyflakes. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
eaf17475b2
commit
ee06020240
|
@ -67,7 +67,6 @@ class DjangoTranslation(gettext_module.GNUTranslations):
|
||||||
Python 2.4.
|
Python 2.4.
|
||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
from django.conf import settings
|
|
||||||
gettext_module.GNUTranslations.__init__(self, *args, **kw)
|
gettext_module.GNUTranslations.__init__(self, *args, **kw)
|
||||||
# Starting with Python 2.4, there's a function to define
|
# Starting with Python 2.4, there's a function to define
|
||||||
# the output charset. Before 2.4, the output charset is
|
# the output charset. Before 2.4, the output charset is
|
||||||
|
@ -136,7 +135,7 @@ def translation(language):
|
||||||
t = gettext_module.translation('django', path, [loc], DjangoTranslation)
|
t = gettext_module.translation('django', path, [loc], DjangoTranslation)
|
||||||
t.set_language(lang)
|
t.set_language(lang)
|
||||||
return t
|
return t
|
||||||
except IOError, e:
|
except IOError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
res = _translation(globalpath)
|
res = _translation(globalpath)
|
||||||
|
@ -166,7 +165,7 @@ def translation(language):
|
||||||
if os.path.isdir(apppath):
|
if os.path.isdir(apppath):
|
||||||
res = _merge(apppath)
|
res = _merge(apppath)
|
||||||
|
|
||||||
if projectpath and os.path.isdir(projectpath):
|
if projectpath and os.path.isdir(projectpath) and projectpath not in settings.LOCALE_PATHS:
|
||||||
res = _merge(projectpath)
|
res = _merge(projectpath)
|
||||||
|
|
||||||
for localepath in reversed(settings.LOCALE_PATHS):
|
for localepath in reversed(settings.LOCALE_PATHS):
|
||||||
|
@ -365,8 +364,6 @@ def get_language_from_request(request):
|
||||||
"""
|
"""
|
||||||
global _accepted
|
global _accepted
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
globalpath = os.path.join(
|
|
||||||
os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
|
|
||||||
supported = dict(settings.LANGUAGES)
|
supported = dict(settings.LANGUAGES)
|
||||||
|
|
||||||
if hasattr(request, 'session'):
|
if hasattr(request, 'session'):
|
||||||
|
|
Loading…
Reference in New Issue