Skip to content

Commit

Permalink
Fixed #4982 -- Fixed handling of '%' symbols in 'blocktrans' blocks. …
Browse files Browse the repository at this point in the history
…Thanks,

permonik@mesias.brnonet.cz.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6565 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Oct 20, 2007
1 parent 3742e35 commit cc6139a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions django/templatetags/i18n.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from django.template import Node, Variable
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
Expand Down Expand Up @@ -68,9 +70,11 @@ def render(self, context):
count = self.counter.resolve(context)
context[self.countervar] = count
plural = self.render_token_list(self.plural)
result = translation.ungettext(singular, plural, count) % context
result = translation.ungettext(singular, plural, count)
else:
result = translation.ugettext(singular) % context
result = translation.ugettext(singular)
# Escape all isolated '%' before substituting in the context.
result = re.sub('%(?!\()', '%%', result) % context
context.pop()
return result

Expand Down

0 comments on commit cc6139a

Please sign in to comment.