Commit 22f7d39d authored by Michal Čihař's avatar Michal Čihař

Add filter for formatting strings

parent 1c350b60
{% extends "base.html" %}
{% load i18n %}
{% load weblate %}
{% block breadcums %}
<li><a href="{{ unit.translation.subproject.project.get_absolute_url }}">{{ unit.translation.subproject.project }}</a></li>
......@@ -24,7 +25,7 @@
<tr><th class="source">{% trans "Source" %}</th><th>{% trans "Translation" %}<th></tr>
{% if unit.is_plural %}
{% else %}
<tr><td class="translatetext">{{ unit.source }}</td><td>
<tr><td class="translatetext">{{ unit.source|fmttranslation }}</td><td>
{{ form.checksum }}
{{ form.target }}
<br />
......@@ -40,7 +41,7 @@
{% if suggestions %}
<ul>
{% for suggestion in suggestions %}
<li><span class="translatetext">{{ suggestion.target }}</span> by {{ suggestion.user }}</li>
<li><span class="translatetext">{{ suggestion.target|fmttranslation }}</span> by {{ suggestion.user }}</li>
{% endfor %}
</ul>
{% else %}
......
from django.template.defaultfilters import stringfilter
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django import template
register = template.Library()
@register.filter
@stringfilter
def fmttranslation(s):
s = escape(s)
return mark_safe(s)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment