logo

searx

My custom branche(s) on searx, a meta-search engine
commit: 2b1d2dbc841d970ed369e6479693dcc80fa01233
parent: a1f945d227577993b0d13e0230356d7462ccc840
Author: asciimoo <asciimoo@gmail.com>
Date:   Wed, 22 Jan 2014 00:17:49 +0100

[enh] i18n support

Diffstat:

Msearx/engines/__init__.py20+++++++++++++++-----
Msearx/templates/engines.html9++++-----
Msearx/templates/index.html4++--
Msearx/templates/preferences.html8++++----
Msearx/templates/results.html6+++---
Msearx/templates/stats.html2+-
6 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py @@ -26,6 +26,7 @@ from searx import settings from searx.utils import gen_useragent import sys from datetime import datetime +from flask.ext.babel import gettext engine_dir = dirname(realpath(__file__)) @@ -269,15 +270,24 @@ def get_engines_stats(): engine['percentage'] = 0 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) ), - ('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) ), - ('Errors', sorted(errors, key=itemgetter('avg'), reverse=True)), + ( + gettext('Errors'), + sorted(errors, key=itemgetter('avg'), reverse=True) + ), ] diff --git a/searx/templates/engines.html b/searx/templates/engines.html @@ -1,12 +1,12 @@ {% extends 'base.html' %} {% block content %} <div class="row"> -<h2>Currently used search engines</h2> + <h2>{{ _('Currently used search engines') }}</h2> <table style="width: 80%;"> <tr> - <th>Engine name</th> - <th>Category</th> + <th>{{ _('Engine name') }}</th> + <th>{{ _('Category') }}</th> </tr> {% for (categ,search_engines) in categs %} {% for search_engine in search_engines %} @@ -20,7 +20,6 @@ {% endfor %} {% endfor %} </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> {% endblock %} diff --git a/searx/templates/index.html b/searx/templates/index.html @@ -4,8 +4,8 @@ <div class="title"><h1>searx</h1></div> {% include 'search.html' %} <p class="top_margin"> - <a href="/about" class="hmarg">about</a> - <a href="/preferences" class="hmarg">preferences</a> + <a href="/about" class="hmarg">{{ _('about') }}</a> + <a href="/preferences" class="hmarg">{{ _('preferences') }}</a> </p> </div> {% endblock %} diff --git a/searx/templates/preferences.html b/searx/templates/preferences.html @@ -2,18 +2,18 @@ {% block head %} {% endblock %} {% block content %} <div class="row"> - <h2>Preferences</h2> + <h2>{{ _('Preferences') }}</h2> <fieldset> - <legend>Default categories</legend> + <legend>{{ _('Default categories') }}</legend> <form method="post" action="/preferences" id="search_form"> <p> {% include 'categories.html' %} </p> - <input type="submit" value="save" /> + <input type="submit" value="{{ _('save') }}" /> </form> </fieldset> - <div class="right"><a href="/">back</a></div> + <div class="right"><a href="/">{{ _('back') }}</a></div> </div> {% endblock %} diff --git a/searx/templates/results.html b/searx/templates/results.html @@ -7,12 +7,12 @@ </div> <div id="results"> {% 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 %} <div id ="result_count"> - Number of results: {{ number_of_results }} + {{ _('Number of results') }}: {{ number_of_results }} </div> {% for result in results %} @@ -23,7 +23,7 @@ {% endif %} {% endfor %} <div id="apis"> - Download results + {{ _('Download results') }} <form method="post" action="/"> <div class="left"> <input type="hidden" name="q" value="{{ q }}" /> diff --git a/searx/templates/stats.html b/searx/templates/stats.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block head %} {% endblock %} {% block content %} -<h2>Engine stats</h2> +<h2>{{ _('Engine stats') }}</h2> {% for stat_name,stat_category in stats %} <div class="left">