File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
#
3
- # Copyright (C) 2007 Edgewall Software
3
+ # Copyright (C) 2007-2010 Edgewall Software
4
4
# All rights reserved.
5
5
#
6
6
# This software is licensed as described in the file COPYING, which
12
12
# history and logs, available at http://babel.edgewall.org/log/.
13
13
14
14
from babel import Locale , UnknownLocaleError
15
- from django .conf import settings
15
+ from django .utils . translation import get_language
16
16
try :
17
17
from threading import local
18
18
except ImportError :
@@ -38,7 +38,7 @@ class LocaleMiddleware(object):
38
38
39
39
def process_request (self , request ):
40
40
try :
41
- code = getattr (request , 'LANGUAGE_CODE' , settings . LANGUAGE_CODE )
41
+ code = getattr (request , 'LANGUAGE_CODE' , get_language () )
42
42
locale = Locale .parse (code , sep = '-' )
43
43
except (ValueError , UnknownLocaleError ):
44
44
pass
Original file line number Diff line number Diff line change 13
13
14
14
from django .conf import settings
15
15
from django .template import Library
16
- from django .utils .translation import to_locale
16
+ from django .utils .translation import to_locale , get_language
17
17
try :
18
18
from pytz import timezone
19
19
except ImportError :
30
30
def _get_format ():
31
31
locale = get_current_locale ()
32
32
if not locale :
33
- locale = Locale .parse (to_locale (settings . LANGUAGE_CODE ))
33
+ locale = Locale .parse (to_locale (get_language () ))
34
34
if timezone :
35
35
tzinfo = timezone (settings .TIME_ZONE )
36
36
else :
You can’t perform that action at this time.
0 commit comments