File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22#
3- # Copyright (C) 2007 Edgewall Software
3+ # Copyright (C) 2007-2010 Edgewall Software
44# All rights reserved.
55#
66# This software is licensed as described in the file COPYING, which
1212# history and logs, available at http://babel.edgewall.org/log/.
1313
1414from babel import Locale , UnknownLocaleError
15- from django .conf import settings
15+ from django .utils . translation import get_language
1616try :
1717 from threading import local
1818except ImportError :
@@ -38,7 +38,7 @@ class LocaleMiddleware(object):
3838
3939 def process_request (self , request ):
4040 try :
41- code = getattr (request , 'LANGUAGE_CODE' , settings . LANGUAGE_CODE )
41+ code = getattr (request , 'LANGUAGE_CODE' , get_language () )
4242 locale = Locale .parse (code , sep = '-' )
4343 except (ValueError , UnknownLocaleError ):
4444 pass
Original file line number Diff line number Diff line change 1313
1414from django .conf import settings
1515from django .template import Library
16- from django .utils .translation import to_locale
16+ from django .utils .translation import to_locale , get_language
1717try :
1818 from pytz import timezone
1919except ImportError :
3030def _get_format ():
3131 locale = get_current_locale ()
3232 if not locale :
33- locale = Locale .parse (to_locale (settings . LANGUAGE_CODE ))
33+ locale = Locale .parse (to_locale (get_language () ))
3434 if timezone :
3535 tzinfo = timezone (settings .TIME_ZONE )
3636 else :
You can’t perform that action at this time.
0 commit comments