diff --git a/html/translate.html b/html/translate.html
index e099a6702..795087273 100644
--- a/html/translate.html
+++ b/html/translate.html
@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
+{% load weblate %}
{% block breadcums %}
{{ unit.translation.subproject.project }}
@@ -24,7 +25,7 @@
{% trans "Source" %} | {% trans "Translation" %} | |
{% if unit.is_plural %}
{% else %}
-{{ unit.source }} |
+ |
{{ unit.source|fmttranslation }} |
{{ form.checksum }}
{{ form.target }}
@@ -40,7 +41,7 @@
{% if suggestions %}
{% for suggestion in suggestions %}
-- {{ suggestion.target }} by {{ suggestion.user }}
+- {{ suggestion.target|fmttranslation }} by {{ suggestion.user }}
{% endfor %}
{% else %}
diff --git a/trans/templatetags/__init__.py b/trans/templatetags/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/trans/templatetags/weblate.py b/trans/templatetags/weblate.py
new file mode 100644
index 000000000..ec336c84e
--- /dev/null
+++ b/trans/templatetags/weblate.py
@@ -0,0 +1,12 @@
+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)
|