mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[refactor] translation engines: common interface
This commit is contained in:
parent
3742d558ac
commit
34b8def91c
8 changed files with 125 additions and 78 deletions
38
searx/templates/simple/answerers/translate.html
Normal file
38
searx/templates/simple/answerers/translate.html
Normal file
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue