summaryrefslogtreecommitdiff
path: root/searx/engines/__init__.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-01-24 09:58:57 +0100
committerAlexandre Flament <alex@al-f.net>2021-02-01 17:10:37 +0100
commitca93a018444041f64c193b4e623b9d6d1150b042 (patch)
treea5c2625b2b929c9144a7c78f9cd06fe54ef9400e /searx/engines/__init__.py
parent99244440e42b970252b63fb1194ee1503afda704 (diff)
[mod] dynamically set language_support variable
The language_support variable is set to True by default, and set to False in only 5 engines. Except the documentation and the /config URL, this variable is not used. This commit remove the variable definition in the engines, and set value according to supported_languages length: False when the length is 0, True otherwise. Close #2485
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r--searx/engines/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index f2b7c5a84..80d5d18fc 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -44,7 +44,6 @@ babel_langs = [lang_parts[0] + '-' + lang_parts[-1] if len(lang_parts) > 1 else
engine_shortcuts = {}
engine_default_args = {'paging': False,
'categories': ['general'],
- 'language_support': True,
'supported_languages': [],
'safesearch': False,
'timeout': settings['outgoing']['request_timeout'],
@@ -127,6 +126,9 @@ def load_engine(engine_data):
setattr(engine, 'language_aliases', language_aliases)
+ # language_support
+ setattr(engine, 'language_support', len(getattr(engine, 'supported_languages', [])) > 0)
+
# assign language fetching method if auxiliary method exists
if hasattr(engine, '_fetch_supported_languages'):
setattr(engine, 'fetch_supported_languages',