summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-10-20 07:36:44 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-10-20 07:36:44 +0000
commit0ab4ae9349d63f6d40b40709417fa02ffb12f2a9 (patch)
tree85c8a8378c603aad658dcdcac1e6be0df18d1938
parentf29aab544772134cf23660614e36cbfd4bb7815c (diff)
i18n: removed special casing for en and en-* - we now have an english translation file, so just handle en the same way as other languages
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/utils/translation.py31
1 files changed, 7 insertions, 24 deletions
diff --git a/django/utils/translation.py b/django/utils/translation.py
index 0737d9a0cd..6362a5923e 100644
--- a/django/utils/translation.py
+++ b/django/utils/translation.py
@@ -114,9 +114,6 @@ def translation(language):
"""
global _translations
- if language == 'en' or language.startswith('en-'):
- return gettext_module.NullTranslations()
-
t = _translations.get(language, None)
if t is not None:
return t
@@ -290,8 +287,6 @@ def get_language_from_request(request):
if request.GET or request.POST:
lang_code = request.GET.get('django_language', None) or request.POST.get('django_language', None)
if lang_code is not None:
- if lang_code == 'en' or lang_code.startswith('en-'):
- return lang_code
lang = gettext_module.find('django', globalpath, [to_locale(lang_code)])
if lang is not None:
if hasattr(request, 'session'):
@@ -303,16 +298,12 @@ def get_language_from_request(request):
if hasattr(request, 'session'):
lang_code = request.session.get('django_language', None)
if lang_code is not None:
- if lang_code == 'en' or lang_code.startswith('en-'):
- return lang_code
lang = gettext_module.find('django', globalpath, [to_locale(lang_code)])
if lang is not None:
return lang_code
lang_code = request.COOKIES.get('django_language', None)
if lang_code is not None:
- if lang_code == 'en' or lang_code.startswith('en-'):
- return lang_code
lang = gettext_module.find('django', globalpath, [to_locale(lang_code)])
if lang is not None:
return lang_code
@@ -341,23 +332,15 @@ def get_language_from_request(request):
langs.sort(lambda a,b: -1*cmp(a[1], b[1]))
for lang, order in langs:
- if lang == 'en' or lang.startswith('en-'):
- # special casing for language en and derivates, because we don't
- # have an english language file available, but just fallback
- # to NullTranslation on those languages (as the source itself
- # is in english)
+ langfile = gettext_module.find('django', globalpath, [to_locale(lang)])
+ if langfile:
+ # reconstruct the actual language from the language
+ # filename, because otherwise we might incorrectly
+ # report de_DE if we only have de available, but
+ # did find de_DE because of language normalization
+ lang = langfile[len(globalpath):].split('/')[1]
_accepted[accept] = lang
return lang
- else:
- langfile = gettext_module.find('django', globalpath, [to_locale(lang)])
- if langfile:
- # reconstruct the actual language from the language
- # filename, because otherwise we might incorrectly
- # report de_DE if we only have de available, but
- # did find de_DE because of language normalization
- lang = langfile[len(globalpath):].split('/')[1]
- _accepted[accept] = lang
- return lang
return settings.LANGUAGE_CODE