#24257: The trans template tag fails to get a message when there is a %
character
in the string
--------------------------------------+------------------------------------
Reporter: aboudreault | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 1.7
Severity: Normal | Keywords: trans templatetag i18n
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
I am using a nested template with translation in my django template file.
This is my basic html code:
{{{
<script id="invoice-date-modal-template" type="text/html">
<div id="modal" class="reveal-modal tiny " data-reveal>
<h5><%= client %> - <%= date %></h5>
<h6>{% trans "Modify the invoice state of <%= client %> dated
of <%= date %>?" %}</h6>
<p>{% trans "Select the session invoice date and confirm."
%}</p>
<div class="row">...</div>
</div>
</script>
}}}
makemessages && compilemessages.
In django.po: I see that the % characters has been doubled:
{{{
msgid ""
"Modify the invoice state of <%%= client %%> of <%%= date %%>?"
msgstr ""
"Changer l'état de facturation de <%%= client %%> du <%%= date %%>?"
}}}
In my web application, I can see that my first trans is not translated,
but the second one is ok.
I've found a workaround for that: using blocktrans instead of trans. Doing
it this way work in my application:
{{{
<h6>{% blocktrans %}Modify the invoice state of <%= client %> of <%= date
%>?{% endblocktrans %}</h6>
}}}
Looks like something is different or missing with the trans template tag.
--
Ticket URL: <https://code.djangoproject.com/ticket/24257>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.962c2594f7404a540170583aca21cefc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.