﻿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
18995	String formatting error when passing floats as values in {% blocktrans %} tags	Bruno Renié	Jacob Walls	"With the following template code:

{{{
{% blocktrans count counter=person.distance_in_miles|floatformat:0 %}{{ counter }} mile away{% plural %}{{ counter }} miles away{% endblocktrans %}
}}}

And a russian translation:

{{{
#, python-format
msgid ""%(counter)s mile away""
msgid_plural ""%(counter)s miles away""
msgstr[0] ""На расстоянии %(counter)s мили""
msgstr[1] ""На расстоянии %(counter)s миль""
msgstr[2] ""На расстоянии %(counter)s миль""
}}}

Rendering the template fails with a String formatting error: ""TypeError: not all arguments converted during string formatting"".

This happens because gettext string formatting fails when a float is passed. Removing the `floatformat` and casting the value as int works fine.

This could be improved by either:

* Swallow `TypeError` and throw a friendlier message saying the type might not be compatible with gettext's string formatting (not a fan of swallowing `TypeError` though, we need to make sure nothing else in do_translate throws such an exception)
* Actively checking the type's compatibility with the string format"	Cleanup/optimization	closed	Internationalization	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
