summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2024-10-15 15:39:14 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-01-28 07:07:08 +0100
commit9079d0cac0156139952446f0fdc8b37b94c10756 (patch)
tree0164ae5b30d173cda9e60ea8048b16033b2029cc /searx/templates
parent70f1b6500861970f8b9e52fbfe52a1796350ea69 (diff)
[refactor] translation engines: common interface
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/simple/answerers/translate.html38
-rw-r--r--searx/templates/simple/results.html22
2 files changed, 52 insertions, 8 deletions
diff --git a/searx/templates/simple/answerers/translate.html b/searx/templates/simple/answerers/translate.html
new file mode 100644
index 000000000..a1c38eecf
--- /dev/null
+++ b/searx/templates/simple/answerers/translate.html
@@ -0,0 +1,38 @@
+<div class="answer-translations">
+{% for translation in translations %}
+ {% if loop.index > 1 %}
+ <hr />
+ {% endif %}
+ <h3>{{ translation.text }}</h3>
+ {% if translation.transliteration %}
+ <b>translation.transliteration</b>
+ {% endif %} {% if translation.definitions %}
+ <dl>
+ <dt>{{ _('Definitions') }}</dt>
+ <ul>
+ {% for definition in translation.definitions %}
+ <li>{{ definition }}</li>
+ {% endfor %}
+ <ul>
+ </dl>
+ {% endif %} {% if translation.examples %}
+ <dl>
+ <dt>{{ _('Examples') }}</dt>
+ <ul>
+ {% for example in translation.examples %}
+ <li>{{ example }}</li>
+ {% endfor %}
+ </ul>
+ </dl>
+ {% endif %} {% if translation.synonyms %}
+ <dl>
+ <dt>{{ _('Synonyms') }}</dt>
+ <ul>
+ {% for synonym in translation.synonyms %}
+ <li>{{ synonym }}</li>
+ {% endfor %}
+ </ul>
+ </dl>
+ {% endif %}
+{% endfor %}
+</div>
diff --git a/searx/templates/simple/results.html b/searx/templates/simple/results.html
index e2d4217d5..047c49dbd 100644
--- a/searx/templates/simple/results.html
+++ b/searx/templates/simple/results.html
@@ -23,14 +23,20 @@
<div id="answers" role="complementary" aria-labelledby="answers-title"><h4 class="title" id="answers-title">{{ _('Answers') }} : </h4>
{%- for answer in answers.values() -%}
<div class="answer">
- <span>{{ answer.answer }}</span>
- {%- if answer.url -%}
- <a href="{{ answer.url }}" class="answer-url"
- {%- if results_on_new_tab %} target="_blank" rel="noopener noreferrer"
- {%- else -%} rel="noreferrer"
- {%- endif -%}
- >{{ urlparse(answer.url).hostname }}</a>
- {% endif -%}
+ {%- if answer.answer_type == 'translations' -%}
+ {% with translations=answer.translations %}
+ {% include 'simple/answerers/translate.html' %}
+ {% endwith %}
+ {%- else -%}
+ <span>{{ answer.answer }}</span>
+ {%- if answer.url -%}
+ <a href="{{ answer.url }}" class="answer-url"
+ {%- if results_on_new_tab %} target="_blank" rel="noopener noreferrer"
+ {%- else -%} rel="noreferrer"
+ {%- endif -%}
+ >{{ urlparse(answer.url).hostname }}</a>
+ {% endif -%}
+ {%- endif -%}
</div>
{%- endfor -%}
</div>