Ticket #4982: patch.diff
File patch.diff, 1016 bytes (added by , 17 years ago) |
---|
-
templatetags/i18n.py
1 import re 1 2 from django.template import Node, resolve_variable 2 3 from django.template import TemplateSyntaxError, TokenParser, Library 3 4 from django.template import TOKEN_TEXT, TOKEN_VAR … … 68 69 count = self.counter.resolve(context) 69 70 context[self.countervar] = count 70 71 plural = self.render_token_list(self.plural) 71 result = translation.ungettext(singular, plural, count) % context72 result = translation.ungettext(singular, plural, count) 72 73 else: 73 result = translation.ugettext(singular) % context 74 result = translation.ugettext(singular) 75 # mask all % not directly followed by ( and rest fill with context 76 result = re.sub('\%(?!\()', '%%', result) % context 74 77 context.pop() 75 78 return result 76 79