Bug: django-rosetta is not able to translate strings that contain a percent sign
Morpho opened this issue · comments
It's not possible to translate a text that contains a percent sign. Rosetta will quote the percent sign with another percent sign (%%) in the admin which is fine, but also in the source. That way the source doesnt match the template text anymore:
For example:
.po File:
: templates/email_template.html:7 templates/email_template.html.py:49
, python-format
msgid ""
"Hinweis: Du erhältst diese E-Mail aufgrund Deiner kostenlosen Anmeldung. "
"Garantie: App ist 100%% gratis!"
msgstr ""
"Note: You get this e-mail due to your free registration. We "
"guarantee: App is 100%% free of charge!"
Template text:
{% trans "Hinweis: Du erhältst diese E-Mail aufgrund Deiner kostenlosen Anmeldung. Garantie: App ist 100% gratis!" %}
This does not match because there are two percent signs in the .po File but just one percent sign in the template.
Uhm nope: Django does that (because gettext does it).
When you add your string containing a percent sign to your template and run makemessages
(before Rosetta touches) it it will be converted to a double-percentage sign.
See https://code.djangoproject.com/ticket/11240 and http://stackoverflow.com/questions/5448207/handling-percent-sign-in-django-blocktrans-tags
Sorry for the confusion, you are right, of course.