#4982: {% blocktrans %} does not escape % in text
------------------------------------------+---------------------------------
Reporter:  nostgard <[EMAIL PROTECTED]>  |       Owner:  mtredinnick 
  Status:  new                            |   Component:  Translations
 Version:  SVN                            |    Keywords:              
   Stage:  Unreviewed                     |   Has_patch:  0           
------------------------------------------+---------------------------------
 When you try to use a blocktrans with a percent sign in it. When the
 percent is escaped (%%) it renders fine. It does not occur when using a
 trans tag.
 
 {{{
 >>> from django.template import Context, Template
 >>> t1 = Template('{% load i18n %}{% blocktrans %}We lost 5% today.{%
 endblocktrans %}')
 >>> t2 = Template('{% load i18n %}{% blocktrans %}We lost 5%% today.{%
 endblocktrans %}')
 >>> t3 = Template('{% load i18n %}{% trans "We lost 5% today." %}')
 >>> c = Context()
 >>> t1.render(c)
 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "D:\Python\lib\site-packages\django\template\__init__.py", line
 181, in render
     return self.nodelist.render(context)
   File "D:\Python\lib\site-packages\django\template\__init__.py", line
 736, in render
     bits.append(self.render_node(node, context))
   File "D:\Python\lib\site-packages\django\template\__init__.py", line
 764, in render_node
     raise wrapped
 TemplateSyntaxError: Caught an exception while rendering: unsupported
 format character 't' (0x74) at index 11
 
 Original Traceback (most recent call last):
   File "D:\Python\lib\site-packages\django\template\__init__.py", line
 754, in render_node
     result = node.render(context)
   File "D:\Python\lib\site-packages\django\templatetags\i18n.py", line 73,
 in render
     result = translation.ugettext(singular) % context
 ValueError: unsupported format character 't' (0x74) at index 11
 
 >>> t2.render(c)
 u'We lost 5% today.'
 >>> t3.render(c)
 u'We lost 5% today.'
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4982>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to