﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5885	simple_tag is not compatible with _() syntax in templates	Dmitri Fedortchenko <zeraien@…>	nobody	"Creating a simple_tag decorated tag and then passing it a _('text') does not work.

The error produced is:
{{{
Failed lookup for key [_('links')]
}}} 

Code that produces this error:
{{{
@register.simple_tag
def title(text):
    return text.title()
}}}

{{{
{% title _('links') %}
}}}

Trace:
{{{
Traceback (most recent call last):
File ""/sw/lib/python2.5/site-packages/django/template/__init__.py"" in render_node
  813. result = node.render(context)
File ""/sw/lib/python2.5/site-packages/django/template/__init__.py"" in render
  930. resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
File ""/sw/lib/python2.5/site-packages/django/template/__init__.py"" in resolve
  707. return self._resolve_lookup(context)
File ""/sw/lib/python2.5/site-packages/django/template/__init__.py"" in _resolve_lookup
  757. raise VariableDoesNotExist(""Failed lookup for key [%s] in %r"", (bit, current)) # missing attribute
}}}

I noticed that the following works:
{{{
{{ _('Translate Me')|title }}
}}}
However the documentation only mentions that the following syntax is possible: 
{{{
{% some_special_tag _(""Page not found"") value|yesno:_(""yes,no"") %}
}}}

In any case, I believe that to make the behaviour of the _() syntax more consistent, it should work even with simple_tag.
I realise that my patch may duplicate some code, but it's the best I could come up with at the moment."		closed	Template system	dev		duplicate	i18n simple_tag translation internationalization templates documentation		Unreviewed	1	0	0	1	0	0
