[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
paging boolean support multible pages
language_support boolean support language choosing
time_range_support boolean support search time range
engine_type str ``online`` by default, other possibles values are
``offline``, ``online_dictionnary``, ``online_currency``
@ -97,7 +96,6 @@ example code
# engine dependent config
categories = ['general']
paging = True
language_support = True
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_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',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@ about = {
# engine dependent config
categories = ['news']
paging = True
language_support = True
# 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

View File

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

View File

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

View File

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