﻿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
30718	blocktrans is crashing when using percent signs when no variables were supplied.	Mikail	nobody	"When using `blocktrans` without supplying any variables and a translator puts a percent sign as a translation, a crash occurs.

For example, using this template snippet:
{{{
{% blocktrans context ""Taxes"" %}
  tax_rate * price
{% endblocktrans %}
}}}

If one translates it to:
{{{
  % imposto * preço
}}}

It will raise:
{{{
TypeError: %i format: a number is required, not dict
}}}

Where stack is:
{{{
  File ""django/core/handlers/exception.py"", line 34, in inner
    response = get_response(request)
  File ""django/core/handlers/base.py"", line 145, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File ""django/core/handlers/base.py"", line 143, in _get_response
    response = response.render()
  File ""django/template/response.py"", line 106, in render
    self.content = self.rendered_content
  File ""django/template/response.py"", line 83, in rendered_content
    content = template.render(context, self._request)
  File ""django/template/backends/django.py"", line 61, in render
    return self.template.render(context)
  File ""django/template/base.py"", line 171, in render
    return self._render(context)
  File ""django/template/base.py"", line 163, in _render
    return self.nodelist.render(context)
  File ""django/template/base.py"", line 937, in render
    bit = node.render_annotated(context)
  File ""django/template/base.py"", line 904, in render_annotated
    return self.render(context)
  File ""django/template/loader_tags.py"", line 150, in render
    return compiled_parent._render(context)
  File ""django/template/base.py"", line 163, in _render
    return self.nodelist.render(context)
  File ""django/template/base.py"", line 937, in render
    bit = node.render_annotated(context)
  File ""django/template/base.py"", line 904, in render_annotated
    return self.render(context)
  File ""django/template/loader_tags.py"", line 150, in render
    return compiled_parent._render(context)
  File ""django/template/base.py"", line 163, in _render
    return self.nodelist.render(context)
  File ""django/template/base.py"", line 937, in render
    bit = node.render_annotated(context)
  File ""django/template/base.py"", line 904, in render_annotated
    return self.render(context)
  File ""django/template/loader_tags.py"", line 62, in render
    result = block.nodelist.render(context)
  File ""django/template/base.py"", line 937, in render
    bit = node.render_annotated(context)
  File ""django/template/base.py"", line 904, in render_annotated
    return self.render(context)
  File ""django/templatetags/i18n.py"", line 161, in render
    result = result % data
}}}

The crashing line being this one: [https://github.com/django/django/blob/1e429df748867097451bf0b45d1080ae6828d921/django/templatetags/i18n.py#L161 1e429df7488/django/templatetags/i18n.py#L161]

The PO compiler doesn't check the validity of the provided translation as the flag [https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html python-format] is not set in the PO file.

We should whether not try to format the string if there is no variable, or force the `python-format` flag to be set to prevent translators from breaking the templates.
"	Bug	closed	Internationalization	dev	Normal	wontfix	i18n blocktrans	Claude Paroz	Unreviewed	0	0	0	0	0	0
