8👍
✅
According to this comment in Django’s Trac, adding a translator comment to deactivate python format above the string that you want to translate can fix / workaround this issue.
If the text to translate is in your Python code, use:
# Translator: xgettext:no-python-format
_('100% butterfly')
For trans
template tag, you can try:
{# Translators: xgettext:no-python-format #}
{% trans "100% butterfly" %}
2👍
I think the better way is to use the html code : %
It is the most elegant way for dealing with django translation for example.
- Add timestamp and username to log
- Filter a Django form select element based on a previously selected element
- How to make UUID field default when there's already ID field
- Multiple sites using Django and mod_wsgi on Apache
- Accessing Many to Many "through" relation fields in Formsets
1👍
Turns out this is a Django problem with a fix possibly coming in Django 1.9.
One workaround is to do:
{% blocktrans with percent="%" %}100{{percent}} butterfly{% endblocktrans %}
Which essentially embraces the python formatting it thinks you’re trying to do when you put a % symbol in your trans text. It’s verbose and sucks, but it works.
- How to connect PyCharm to a Heroku postgres database
- Django admin, filter objects for inline formset
- Django csrf for api that works with ios apps
Source:stackexchange.com