Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 852dfc77 authored by asciimoo's avatar asciimoo
Browse files

[enh] configurable localization

parent a6c31ef7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,8 +43,11 @@ production: bin/buildout production.cfg setup.py
minimal: bin/buildout minimal.cfg setup.py
	bin/buildout -c minimal.cfg $(options)

locales:
	@pybabel compile -d searx/translations

clean:
	@rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs \
		searx.egg-info lib include .coverage coverage

.PHONY: all tests robot flake8 coverage production minimal clean
.PHONY: all tests robot flake8 coverage production minimal locales clean
+1 −1
Original line number Diff line number Diff line
@@ -106,6 +106,6 @@ engines:
    title_xpath : ./a/div[@class="data"]/p[@class="title"]/text()
    content_xpath : ./a/img/@src

languages:
locales:
    en : English
    hu : Magyar
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ input[type="submit"] { border: 1px solid #666666; color: #444444; padding: 4px;

input[type="checkbox"] { visibility: hidden; }

fieldset { margin: 8px; }

#categories { margin: 0 10px; }

.checkbox_container { display: inline-block; position: relative; margin: 0 3px; padding: 0px; }
+1 −1
Original line number Diff line number Diff line
<div id="categories">
{% for category in categories %}
    <div class="checkbox_container">
        <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}">{{ category }}</label>
        <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
    </div>
{% endfor %}
</div>
+13 −3
Original line number Diff line number Diff line
@@ -5,15 +5,25 @@
    <h2>{{ _('Preferences') }}</h2>


    <form method="post" action="/preferences" id="search_form">
    <fieldset>
        <legend>{{ _('Default categories') }}</legend>
        <form method="post" action="/preferences" id="search_form">
        <p>
        {% include 'categories.html' %}
        </p>
    </fieldset>
    <fieldset>
        <legend>{{ _('Interface language') }}</legend>
        <p>
        <select name='locale'>
            {% for locale_id,locale_name in locales.items() %}
            <option value={{ locale_id }} {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name}}</option>
            {% endfor %}
        </select>
        </p>
    </fieldset>
    <input type="submit" value="{{ _('save') }}" />
    </form>
    </fieldset>
    <div class="right"><a href="/">{{ _('back') }}</a></div>
</div>
{% endblock %}
Loading