From 7ed40733355b5ea1c7138f36508ccf8e73617398 Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Tue, 11 Oct 2005 18:26:32 +0000 Subject: [PATCH] i18n: corrected sublanguage handling (de-de now mapps to de, if de-de isn't present) in django.utils.translation git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@841 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/translation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/django/utils/translation.py b/django/utils/translation.py index caf9dcd76b..96c98f691a 100644 --- a/django/utils/translation.py +++ b/django/utils/translation.py @@ -282,6 +282,11 @@ def get_language_from_request(request): if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')): _accepted[accept] = lang return lang + elif lang.find('-') >= 0: + (lang, sublang) = lang.split('-', 1) + if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')): + _accepted[accept] = lang + return lang return settings.LANGUAGE_CODE