forked from zaclys/searxng
[enh] i18n support
This commit is contained in:
parent
a1f945d227
commit
2b1d2dbc84
|
@ -26,6 +26,7 @@ from searx import settings
|
||||||
from searx.utils import gen_useragent
|
from searx.utils import gen_useragent
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from flask.ext.babel import gettext
|
||||||
|
|
||||||
engine_dir = dirname(realpath(__file__))
|
engine_dir = dirname(realpath(__file__))
|
||||||
|
|
||||||
|
@ -269,15 +270,24 @@ def get_engines_stats():
|
||||||
engine['percentage'] = 0
|
engine['percentage'] = 0
|
||||||
|
|
||||||
return [
|
return [
|
||||||
('Page loads (sec)', sorted(pageloads, key=itemgetter('avg'))),
|
|
||||||
(
|
(
|
||||||
'Number of results',
|
gettext('Page loads (sec)'),
|
||||||
|
sorted(pageloads, key=itemgetter('avg'))
|
||||||
|
),
|
||||||
|
(
|
||||||
|
gettext('Number of results'),
|
||||||
sorted(results, key=itemgetter('avg'), reverse=True)
|
sorted(results, key=itemgetter('avg'), reverse=True)
|
||||||
),
|
),
|
||||||
('Scores', sorted(scores, key=itemgetter('avg'), reverse=True)),
|
|
||||||
(
|
(
|
||||||
'Scores per result',
|
gettext('Scores'),
|
||||||
|
sorted(scores, key=itemgetter('avg'), reverse=True)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
gettext('Scores per result'),
|
||||||
sorted(scores_per_result, key=itemgetter('avg'), reverse=True)
|
sorted(scores_per_result, key=itemgetter('avg'), reverse=True)
|
||||||
),
|
),
|
||||||
('Errors', sorted(errors, key=itemgetter('avg'), reverse=True)),
|
(
|
||||||
|
gettext('Errors'),
|
||||||
|
sorted(errors, key=itemgetter('avg'), reverse=True)
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Currently used search engines</h2>
|
<h2>{{ _('Currently used search engines') }}</h2>
|
||||||
|
|
||||||
<table style="width: 80%;">
|
<table style="width: 80%;">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Engine name</th>
|
<th>{{ _('Engine name') }}</th>
|
||||||
<th>Category</th>
|
<th>{{ _('Category') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for (categ,search_engines) in categs %}
|
{% for (categ,search_engines) in categs %}
|
||||||
{% for search_engine in search_engines %}
|
{% for search_engine in search_engines %}
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<p>Please add more engines to this list, pull requests are welcome!</p>
|
<p class="right"><a href="/">{{ _('back') }}</a></p>
|
||||||
<p class="right"><a href="/">back</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<div class="title"><h1>searx</h1></div>
|
<div class="title"><h1>searx</h1></div>
|
||||||
{% include 'search.html' %}
|
{% include 'search.html' %}
|
||||||
<p class="top_margin">
|
<p class="top_margin">
|
||||||
<a href="/about" class="hmarg">about</a>
|
<a href="/about" class="hmarg">{{ _('about') }}</a>
|
||||||
<a href="/preferences" class="hmarg">preferences</a>
|
<a href="/preferences" class="hmarg">{{ _('preferences') }}</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
{% block head %} {% endblock %}
|
{% block head %} {% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>Preferences</h2>
|
<h2>{{ _('Preferences') }}</h2>
|
||||||
|
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Default categories</legend>
|
<legend>{{ _('Default categories') }}</legend>
|
||||||
<form method="post" action="/preferences" id="search_form">
|
<form method="post" action="/preferences" id="search_form">
|
||||||
<p>
|
<p>
|
||||||
{% include 'categories.html' %}
|
{% include 'categories.html' %}
|
||||||
</p>
|
</p>
|
||||||
<input type="submit" value="save" />
|
<input type="submit" value="{{ _('save') }}" />
|
||||||
</form>
|
</form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="right"><a href="/">back</a></div>
|
<div class="right"><a href="/">{{ _('back') }}</a></div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="results">
|
<div id="results">
|
||||||
{% if suggestions %}
|
{% if suggestions %}
|
||||||
<div id="suggestions"><span>Suggestions: </span>{% for suggestion in suggestions %}<form method="post" action="/"><input type="hidden" name="q" value="{{suggestion}}"><input type="submit" value="{{ suggestion }}" /></form>{% endfor %}</div>
|
<div id="suggestions"><span>{{ _('Suggestions') }}:</span>{% for suggestion in suggestions %}<form method="post" action="/"><input type="hidden" name="q" value="{{suggestion}}"><input type="submit" value="{{ suggestion }}" /></form>{% endfor %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div id ="result_count">
|
<div id ="result_count">
|
||||||
Number of results: {{ number_of_results }}
|
{{ _('Number of results') }}: {{ number_of_results }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for result in results %}
|
{% for result in results %}
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div id="apis">
|
<div id="apis">
|
||||||
Download results
|
{{ _('Download results') }}
|
||||||
<form method="post" action="/">
|
<form method="post" action="/">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<input type="hidden" name="q" value="{{ q }}" />
|
<input type="hidden" name="q" value="{{ q }}" />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %} {% endblock %}
|
{% block head %} {% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Engine stats</h2>
|
<h2>{{ _('Engine stats') }}</h2>
|
||||||
|
|
||||||
{% for stat_name,stat_category in stats %}
|
{% for stat_name,stat_category in stats %}
|
||||||
<div class="left">
|
<div class="left">
|
||||||
|
|
Loading…
Reference in New Issue