Ticket #12104: django_svn_blocktrans_patch.diff

File django_svn_blocktrans_patch.diff, 1.0 KB (added by philipn, 15 years ago)
  • i18n.py

     
    33from django.template import Node, Variable, VariableNode, _render_value_in_context
    44from django.template import TemplateSyntaxError, TokenParser, Library
    55from django.template import TOKEN_TEXT, TOKEN_VAR
     6from django.template import Context, Template
    67from django.utils import translation
    78from django.utils.encoding import force_unicode
    89
     
    8283            result = translation.ugettext(singular)
    8384        # Escape all isolated '%' before substituting in the context.
    8485        result = re.sub(u'%(?!\()', u'%%', result)
    85         data = dict([(v, _render_value_in_context(context[v], context)) for v in vars])
     86        data = {}
     87        c = Context(context)
     88        for v in vars:
     89            t = Template("{{%s}}" % v)
     90            rendered_val = _render_value_in_context(t.render(c), context)
     91            data[v] = rendered_val
    8692        context.pop()
    8793        return result % data
    8894
Back to Top