mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
i18n: enhanced the filter-argument-parser to parse _("") strings, too
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@834 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f882f3eea9
commit
0cd2968973
@ -363,6 +363,13 @@ class FilterParser:
|
|||||||
def read_arg(self):
|
def read_arg(self):
|
||||||
# First read a "
|
# First read a "
|
||||||
self.next_char()
|
self.next_char()
|
||||||
|
translated = False
|
||||||
|
if self.current == '_':
|
||||||
|
self.next_char()
|
||||||
|
if self.current != '(':
|
||||||
|
raise TemplateSyntaxError, "Bad character (expecting '(') '%s'" % self.current
|
||||||
|
translated = True
|
||||||
|
self.next_char()
|
||||||
if self.current != '"':
|
if self.current != '"':
|
||||||
raise TemplateSyntaxError, "Bad character (expecting '\"') '%s'" % self.current
|
raise TemplateSyntaxError, "Bad character (expecting '\"') '%s'" % self.current
|
||||||
self.escaped = False
|
self.escaped = False
|
||||||
@ -389,6 +396,10 @@ class FilterParser:
|
|||||||
arg += self.current
|
arg += self.current
|
||||||
# self.current must now be '"'
|
# self.current must now be '"'
|
||||||
self.next_char()
|
self.next_char()
|
||||||
|
if translated:
|
||||||
|
if self.current != ')':
|
||||||
|
raise TemplateSyntaxError, "Bad character (expecting ')') '%s'" % self.current
|
||||||
|
self.next_char()
|
||||||
return arg
|
return arg
|
||||||
|
|
||||||
def get_filters_from_token(token):
|
def get_filters_from_token(token):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user