﻿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
27221	Document how to escape a percent symbol in ugettext	Paolo Dente	Henry Dang	"While {% trans %} and {% blocktrans %} correctly escape '%' with '%%' in templates, using ugettext or ugettext_lazy does not; this results in errors with compilemessages.

Example:

{{{
price_adjust = models.DecimalField(max_digits=5, decimal_places=2, default=1, choices=(('0.90', _('10% discount'), ))
}}}
will generate:
{{{
#, python-format
msgid ""10% discount""
msgstr """"
}}}
When this is translated to German escaping the %, like:
{{{
#, python-format
msgid ""10% discount""
msgstr ""10%% Rabatt""
}}}
This results in an error message:
{{{
Execution of msgfmt failed: /vagrant/src/locale_files/en/LC_MESSAGES/django.po:xxx: number of format specifications in 'msgid' and 'msgstr' does not match
}}}
On the other hand, when it's not escaped, the error becomes:
{{{
Execution of msgfmt failed: /vagrant/src/locale_files/en/LC_MESSAGES/django.po:xxx: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: In the directive number 1, the character 'R' is not a valid conversion specifier.
}}}

Also, while trying to find a solution for this, I've found this suggestion: https://code.djangoproject.com/ticket/24257#comment:2 - which doesn't work for me at all. The only way I found is to use %(percent)s in the string, which is awkward and difficult to read by the actual translators."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed	ugettext percent		Ready for checkin	1	0	0	0	0	0
