diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-11 18:26:32 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-11 18:26:32 +0000 |
| commit | 7ed40733355b5ea1c7138f36508ccf8e73617398 (patch) | |
| tree | c1d76fa72cb5b606bd9e0be4f62ccb13fbbdb0ab | |
| parent | ef9207b66149efb48f10910e18166f40aa298014 (diff) | |
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
| -rw-r--r-- | django/utils/translation.py | 5 |
1 files changed, 5 insertions, 0 deletions
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 |
