Index: django/utils/translation/trans_real.py
===================================================================
--- django/utils/translation/trans_real.py	(revision 7020)
+++ django/utils/translation/trans_real.py	(working copy)
@@ -357,8 +357,8 @@
         return lang_code
 
     accept = request.META.get('HTTP_ACCEPT_LANGUAGE', '')
-    for lang, unused in parse_accept_lang_header(accept):
-        if lang == '*':
+    for accept_lang, unused in parse_accept_lang_header(accept):
+        if accept_lang == '*':
             break
 
         # We have a very restricted form for our language files (no encoding
@@ -366,7 +366,7 @@
         # language each time. So we avoid the overhead of gettext.find() and
         # look up the MO file manually.
 
-        normalized = locale.locale_alias.get(to_locale(lang, True))
+        normalized = locale.locale_alias.get(to_locale(accept_lang, True))
         if not normalized:
             continue
 
@@ -378,10 +378,11 @@
             # need to check again.
             return _accepted[normalized]
 
-        for lang in (normalized, normalized.split('_')[0]):
+        for lang in (accept_lang, accept_lang.split('-')[0]):
             if lang not in supported:
                 continue
-            langfile = os.path.join(globalpath, lang, 'LC_MESSAGES',
+            normalized = locale.locale_alias.get(to_locale(lang, True)).split('.')[0]
+            langfile = os.path.join(globalpath, normalized, 'LC_MESSAGES',
                     'django.mo')
             if os.path.exists(langfile):
                 _accepted[normalized] = lang
