Is there a simple solution for marking the string parameters inclusion_tag
(or the template as a whole) for translation? In this example, I want to mark the second parameter for translation:
{% render_tile_section qs "Foo" %}
Using include_tag like this obviously doesn't work:
from django.utils.translation import ugettext_lazy as _ @register.inclusion_tag('content/includes/tile_section.html') def render_tile_section(qs, headline=''): return {'qs': qs, 'headline': u'%s' % _(headline) if headline else ''}
My first idea was to subclass inclusion_tag
and make it work as a trans
tag for string parameters. But as far as I know, the Django makemessages
team will only evaluate trans
and blocktrans
in templates, or do I have a way to extend it? Any other ideas?
source share