From e28c6bda35666aa382e6563f4f209d677b9f5ff3 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 21 Dec 2021 09:39:03 +0100 Subject: [PATCH] [doc] introduce about.language and sort engines by it --- docs/admin/engines/configured_engines.rst | 3 +++ docs/conf.py | 6 +++++- searx/engines/duden.py | 1 + searx/engines/ina.py | 1 + searx/engines/mediathekviewweb.py | 1 + searx/engines/seznam.py | 1 + searx/engines/sjp.py | 1 + searx/settings.yml | 6 ++++++ 8 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/admin/engines/configured_engines.rst b/docs/admin/engines/configured_engines.rst index a36114488..3e4aa7a29 100644 --- a/docs/admin/engines/configured_engines.rst +++ b/docs/admin/engines/configured_engines.rst @@ -43,6 +43,9 @@ Explanation of the :ref:`general engine configuration` shown in the table - ``!{{mod.shortcut}}`` - {{mod.__name__}} - {{(mod.disabled and "y") or ""}} + {%- if mod.about and mod.about.language %} + ({{mod.about.language | upper}}) + {%- endif %} - {{mod.timeout}} - {{mod.weight or 1 }} {% if mod.engine_type == 'online' %} diff --git a/docs/conf.py b/docs/conf.py index d843a5a3f..c755b8406 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -50,7 +50,11 @@ jinja_contexts = { }, } jinja_filters = { - 'sort_engines': lambda engines: sorted(engines, key=lambda engine: (engine[1].disabled, engine[0])) + 'sort_engines': + lambda engines: sorted( + engines, + key=lambda engine: (engine[1].disabled, engine[1].about.get('language', ''), engine[0]) + ) } # usage:: lorem :patch:`f373169` ipsum diff --git a/searx/engines/duden.py b/searx/engines/duden.py index 57c76e970..bc4211c67 100644 --- a/searx/engines/duden.py +++ b/searx/engines/duden.py @@ -16,6 +16,7 @@ about = { "use_official_api": False, "require_api_key": False, "results": 'HTML', + "language": 'de', } categories = ['general'] diff --git a/searx/engines/ina.py b/searx/engines/ina.py index efcc03e39..81172ef8c 100644 --- a/searx/engines/ina.py +++ b/searx/engines/ina.py @@ -18,6 +18,7 @@ about = { "use_official_api": False, "require_api_key": False, "results": 'HTML', + "language": 'fr', } # engine dependent config diff --git a/searx/engines/mediathekviewweb.py b/searx/engines/mediathekviewweb.py index bd7c16a5d..d4cb853d4 100644 --- a/searx/engines/mediathekviewweb.py +++ b/searx/engines/mediathekviewweb.py @@ -14,6 +14,7 @@ about = { "use_official_api": True, "require_api_key": False, "results": 'JSON', + "language": "de", } categories = ['videos'] diff --git a/searx/engines/seznam.py b/searx/engines/seznam.py index 9cd50dfc0..85cb25b7f 100644 --- a/searx/engines/seznam.py +++ b/searx/engines/seznam.py @@ -22,6 +22,7 @@ about = { "use_official_api": False, "require_api_key": False, "results": "HTML", + "language": "cz", } base_url = 'https://search.seznam.cz/' diff --git a/searx/engines/sjp.py b/searx/engines/sjp.py index e26a42a53..884fddd2d 100644 --- a/searx/engines/sjp.py +++ b/searx/engines/sjp.py @@ -18,6 +18,7 @@ about = { "use_official_api": False, "require_api_key": False, "results": 'HTML', + "language": 'pl', } categories = ['general'] diff --git a/searx/settings.yml b/searx/settings.yml index 434ec0fa9..475f78e8b 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -352,6 +352,9 @@ engines: use_official_api: false require_api_key: false results: HTML + # We don't set language: de here because media.ccc.de is not just + # for a German audience. It contains many English videos and many + # German videos have English subtitles. - name: ccengine engine: ccengine @@ -1573,6 +1576,7 @@ engines: use_official_api: false require_api_key: false results: HTML + language: ko - name: rubygems shortcut: rbg @@ -1649,6 +1653,7 @@ engines: use_official_api: false require_api_key: false results: HTML + language: de - name: słownik języka polskiego engine: sjp @@ -1676,6 +1681,7 @@ engines: use_official_api: false require_api_key: false results: HTML + language: fr - name: brave shortcut: brave