Skip to content

Commit ff8e5d7

Browse files
committed
More merging with cmlenz github repo
1 parent fca0f37 commit ff8e5d7

File tree

8 files changed

+11
-245
lines changed

8 files changed

+11
-245
lines changed

babeldjango/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

babeldjango/extract.py

Lines changed: 0 additions & 102 deletions
This file was deleted.

babeldjango/middleware.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

babeldjango/templatetags/__init__.py

Whitespace-only changes.

babeldjango/templatetags/babel.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

django_babel/__init__.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
2+
3+
__version__ = '1.0-dev'

django_babel/extract.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
13-
142
from babel.core import *
153

164
from django.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
175
from django.utils.translation.trans_real import inline_re, block_re, \
186
endblock_re, plural_re, \
197
constant_re
208

9+
2110
def extract_django(fileobj, keywords, comment_tags, options):
2211
"""Extract messages from Django template files.
2312
@@ -36,7 +25,11 @@ def extract_django(fileobj, keywords, comment_tags, options):
3625
singular = []
3726
plural = []
3827
lineno = 1
39-
for t in Lexer(fileobj.read(), None).tokenize():
28+
29+
encoding = options.get('encoding', 'utf8')
30+
text = fileobj.read().decode(encoding)
31+
32+
for t in Lexer(text, None).tokenize():
4033
lineno += t.contents.count('\n')
4134
if intrans:
4235
if t.token_type == TOKEN_BLOCK:

django_babel/middleware.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007-2010 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
132

143
from babel import Locale, UnknownLocaleError
154
from django.utils.translation import get_language
@@ -18,14 +7,16 @@
187
except ImportError:
198
from django.utils._threading_local import local
209

10+
2111
__all__ = ['get_current_locale', 'LocaleMiddleware']
2212

2313
_thread_locals = local()
2414

15+
2516
def get_current_locale():
2617
"""Get current locale data outside views.
2718
28-
See http://babel.edgewall.org/wiki/ApiDocs/babel.core for Locale
19+
See http://babel.pocoo.org/docs/api/core/#babel.core.Locale for Locale
2920
objects documentation
3021
"""
3122
return getattr(_thread_locals, 'locale', None)

0 commit comments

Comments
 (0)