1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-19 19:00:10 +01:00

[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
This commit is contained in:
Alexandre Flament 2021-01-24 09:58:57 +01:00
parent 99244440e4
commit ca93a01844
32 changed files with 3 additions and 33 deletions

View File

@ -42,7 +42,6 @@ argument type information
======================= =========== ======================================================== ======================= =========== ========================================================
categories list pages, in which the engine is working categories list pages, in which the engine is working
paging boolean support multible pages paging boolean support multible pages
language_support boolean support language choosing
time_range_support boolean support search time range time_range_support boolean support search time range
engine_type str ``online`` by default, other possibles values are engine_type str ``online`` by default, other possibles values are
``offline``, ``online_dictionnary``, ``online_currency`` ``offline``, ``online_dictionnary``, ``online_currency``
@ -97,7 +96,6 @@ example code
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = True
making a request making a request

View File

@ -44,7 +44,6 @@ babel_langs = [lang_parts[0] + '-' + lang_parts[-1] if len(lang_parts) > 1 else
engine_shortcuts = {} engine_shortcuts = {}
engine_default_args = {'paging': False, engine_default_args = {'paging': False,
'categories': ['general'], 'categories': ['general'],
'language_support': True,
'supported_languages': [], 'supported_languages': [],
'safesearch': False, 'safesearch': False,
'timeout': settings['outgoing']['request_timeout'], 'timeout': settings['outgoing']['request_timeout'],
@ -127,6 +126,9 @@ def load_engine(engine_data):
setattr(engine, 'language_aliases', language_aliases) 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 # assign language fetching method if auxiliary method exists
if hasattr(engine, '_fetch_supported_languages'): if hasattr(engine, '_fetch_supported_languages'):
setattr(engine, 'fetch_supported_languages', setattr(engine, 'fetch_supported_languages',

View File

@ -21,7 +21,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['it'] categories = ['it']
language_support = True
paging = True paging = True
base_url = 'https://wiki.archlinux.org' base_url = 'https://wiki.archlinux.org'

View File

@ -24,7 +24,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = True
supported_languages_url = 'https://www.bing.com/account/general' supported_languages_url = 'https://www.bing.com/account/general'
language_aliases = {'zh-CN': 'zh-CHS', 'zh-TW': 'zh-CHT', 'zh-HK': 'zh-CHT'} language_aliases = {'zh-CN': 'zh-CHS', 'zh-TW': 'zh-CHT', 'zh-HK': 'zh-CHT'}

View File

@ -26,7 +26,6 @@ categories = ['images']
paging = True paging = True
safesearch = True safesearch = True
time_range_support = True time_range_support = True
language_support = True
supported_languages_url = 'https://www.bing.com/account/general' supported_languages_url = 'https://www.bing.com/account/general'
number_of_results = 28 number_of_results = 28

View File

@ -25,7 +25,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['news'] categories = ['news']
paging = True paging = True
language_support = True
time_range_support = True time_range_support = True
# search-url # search-url

View File

@ -26,7 +26,6 @@ paging = True
safesearch = True safesearch = True
time_range_support = True time_range_support = True
number_of_results = 28 number_of_results = 28
language_support = True
base_url = 'https://www.bing.com/' base_url = 'https://www.bing.com/'
search_string = 'videos/search'\ search_string = 'videos/search'\

View File

@ -21,7 +21,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['videos'] categories = ['videos']
paging = True paging = True
language_support = True
# search-url # search-url
# see http://www.dailymotion.com/doc/api/obj-video.html # see http://www.dailymotion.com/doc/api/obj-video.html

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] # TODO , 'images', 'music', 'videos', 'files' categories = ['general'] # TODO , 'images', 'music', 'videos', 'files'
paging = False paging = False
language_support = False
number_of_results = 5 number_of_results = 5
# search-url # search-url

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = False paging = False
language_support = True
supported_languages_url = 'https://duckduckgo.com/util/u172.js' supported_languages_url = 'https://duckduckgo.com/util/u172.js'
time_range_support = True time_range_support = True

View File

@ -26,7 +26,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['images'] categories = ['images']
paging = True paging = True
language_support = True
safesearch = True safesearch = True
# search-url # search-url

View File

@ -20,7 +20,6 @@ about = {
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = False
# search-url # search-url
base_url = 'https://www.duden.de/' base_url = 'https://www.duden.de/'

View File

@ -19,7 +19,6 @@ about = {
categories = ['general'] categories = ['general']
paging = False paging = False
language_support = False
safesearch = True safesearch = True
base_url = 'https://www.etools.ch' base_url = 'https://www.etools.ch'

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['music'] categories = ['music']
paging = True paging = True
language_support = False
page_size = 5 page_size = 5
url = 'https://genius.com/api/' url = 'https://genius.com/api/'

View File

@ -19,7 +19,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['it'] categories = ['it']
language_support = True
paging = True paging = True
base_url = 'https://wiki.gentoo.org' base_url = 'https://wiki.gentoo.org'

View File

@ -24,7 +24,6 @@ about = {
categories = ['general'] categories = ['general']
# gigablast's pagination is totally damaged, don't use it # gigablast's pagination is totally damaged, don't use it
paging = False paging = False
language_support = True
safesearch = True safesearch = True
# search-url # search-url

View File

@ -31,7 +31,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = True
time_range_support = True time_range_support = True
safesearch = True safesearch = True
supported_languages_url = 'https://www.google.com/preferences?#languages' supported_languages_url = 'https://www.google.com/preferences?#languages'

View File

@ -56,7 +56,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['images'] categories = ['images']
paging = False paging = False
language_support = True
use_locale_domain = True use_locale_domain = True
time_range_support = True time_range_support = True
safesearch = True safesearch = True

View File

@ -68,7 +68,6 @@ time_range_dict = {
categories = ['news'] categories = ['news']
paging = False paging = False
language_support = True
use_locale_domain = True use_locale_domain = True
time_range_support = True time_range_support = True

View File

@ -21,7 +21,6 @@ about = {
# engine dependent config # engine dependent config
categories = ["videos", "music"] categories = ["videos", "music"]
paging = True paging = True
language_support = True
time_range_support = True time_range_support = True

View File

@ -19,7 +19,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
language_support = True
paging = True paging = True
number_of_results = 1 number_of_results = 1
search_type = 'nearmatch' # possible values: title, text, nearmatch search_type = 'nearmatch' # possible values: title, text, nearmatch

View File

@ -21,7 +21,6 @@ about = {
# engine dependent config # engine dependent config
categories = ["videos"] categories = ["videos"]
paging = True paging = True
language_support = True
base_url = "https://peer.tube/" base_url = "https://peer.tube/"
supported_languages_url = base_url + "api/v1/videos/languages" supported_languages_url = base_url + "api/v1/videos/languages"

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['map'] categories = ['map']
paging = False paging = False
language_support = True
number_of_results = 10 number_of_results = 10
# search-url # search-url

View File

@ -23,7 +23,6 @@ about = {
# engine dependent config # engine dependent config
categories = [] categories = []
paging = True paging = True
language_support = True
supported_languages_url = 'https://qwant.com/region' supported_languages_url = 'https://qwant.com/region'
category_to_keyword = {'general': 'web', category_to_keyword = {'general': 'web',

View File

@ -20,7 +20,6 @@ about = {
categories = ['videos'] categories = ['videos']
paging = True paging = True
language_support = True
time_range_support = True time_range_support = True
safesearch = True safesearch = True
supported_languages = [ supported_languages = [

View File

@ -29,7 +29,6 @@ categories = ['general']
# storing of qid's between mulitble search-calls # storing of qid's between mulitble search-calls
paging = True paging = True
language_support = True
supported_languages_url = 'https://www.startpage.com/do/settings' supported_languages_url = 'https://www.startpage.com/do/settings'
# search-url # search-url

View File

@ -24,7 +24,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general', 'images'] # TODO , 'music', 'videos', 'files' categories = ['general', 'images'] # TODO , 'music', 'videos', 'files'
paging = True paging = True
language_support = True
number_of_results = 5 number_of_results = 5
http_digest_auth_user = "" http_digest_auth_user = ""
http_digest_auth_pass = "" http_digest_auth_pass = ""

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = True
time_range_support = True time_range_support = True
# search-url # search-url

View File

@ -25,7 +25,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['news'] categories = ['news']
paging = True paging = True
language_support = True
# search-url # search-url
search_url = 'https://news.search.yahoo.com/search?{query}&b={offset}&{lang}=uh3_news_web_gs_1&pz=10&xargs=0&vl=lang_{lang}' # noqa search_url = 'https://news.search.yahoo.com/search?{query}&b={offset}&{lang}=uh3_news_web_gs_1&pz=10&xargs=0&vl=lang_{lang}' # noqa

View File

@ -23,7 +23,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['general'] categories = ['general']
paging = True paging = True
language_support = True # TODO
default_tld = 'com' default_tld = 'com'
language_map = {'ru': 'ru', language_map = {'ru': 'ru',

View File

@ -21,7 +21,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['videos', 'music'] categories = ['videos', 'music']
paging = False paging = False
language_support = True
api_key = None api_key = None
# search-url # search-url

View File

@ -20,7 +20,6 @@ about = {
# engine dependent config # engine dependent config
categories = ['videos', 'music'] categories = ['videos', 'music']
paging = True paging = True
language_support = False
time_range_support = True time_range_support = True
# search-url # search-url