summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorNoémi Ványi <sitbackandwait@gmail.com>2019-01-06 15:27:46 +0100
committerNoémi Ványi <sitbackandwait@gmail.com>2019-01-07 21:19:00 +0100
commitb63d645a52d663036b97e31a59818d79faa4da81 (patch)
tree6ba72217200a0f52f82ba8244afbee19c24d098c /searx
parent491792c1a58f71083f6af663bb6d93e40fa44c9f (diff)
downloadsearxng-b63d645a52d663036b97e31a59818d79faa4da81.tar.gz
searxng-b63d645a52d663036b97e31a59818d79faa4da81.zip
Revert "remove 'all' option from search languages"
This reverts commit 4d1770398a6af8902e75c0bd885781584d39e796.
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/archlinux.py4
-rw-r--r--searx/engines/bing.py5
-rw-r--r--searx/engines/bing_news.py5
-rw-r--r--searx/engines/dailymotion.py5
-rw-r--r--searx/engines/duckduckgo.py12
-rw-r--r--searx/engines/duckduckgo_images.py8
-rw-r--r--searx/engines/faroo.py5
-rw-r--r--searx/engines/gigablast.py9
-rw-r--r--searx/engines/google.py6
-rw-r--r--searx/engines/google_news.py7
-rw-r--r--searx/engines/mediawiki.py5
-rw-r--r--searx/engines/photon.py7
-rw-r--r--searx/engines/qwant.py5
-rw-r--r--searx/engines/startpage.py5
-rw-r--r--searx/engines/subtitleseeker.py2
-rw-r--r--searx/engines/swisscows.py8
-rw-r--r--searx/engines/twitter.py7
-rw-r--r--searx/engines/wikidata.py5
-rw-r--r--searx/engines/wikipedia.py3
-rw-r--r--searx/engines/yacy.py4
-rw-r--r--searx/engines/yahoo.py17
-rw-r--r--searx/engines/yahoo_news.py5
-rw-r--r--searx/engines/youtube_api.py4
-rw-r--r--searx/preferences.py1
-rw-r--r--searx/search.py6
-rw-r--r--searx/settings_robot.yml2
-rw-r--r--searx/templates/courgette/preferences.html1
-rw-r--r--searx/templates/legacy/preferences.html1
-rw-r--r--searx/templates/oscar/languages.html11
-rw-r--r--searx/templates/pix-art/preferences.html1
-rw-r--r--searx/webapp.py17
31 files changed, 128 insertions, 55 deletions
diff --git a/searx/engines/archlinux.py b/searx/engines/archlinux.py
index fc08112af..dce862f55 100644
--- a/searx/engines/archlinux.py
+++ b/searx/engines/archlinux.py
@@ -36,7 +36,7 @@ def locale_to_lang_code(locale):
# wikis for some languages were moved off from the main site, we need to make
# requests to correct URLs to be able to get results in those languages
lang_urls = {
- 'en': {
+ 'all': {
'base': 'https://wiki.archlinux.org',
'search': '/index.php?title=Special:Search&offset={offset}&{query}'
},
@@ -67,7 +67,7 @@ lang_urls = {
def get_lang_urls(language):
if language in lang_urls:
return lang_urls[language]
- return lang_urls['en']
+ return lang_urls['all']
# Language names to build search requests for
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index 2da40619d..742379c1a 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -34,7 +34,10 @@ search_string = 'search?{query}&first={offset}'
def request(query, params):
offset = (params['pageno'] - 1) * 10 + 1
- lang = match_language(params['language'], supported_languages, language_aliases)
+ if params['language'] == 'all':
+ lang = 'EN'
+ else:
+ lang = match_language(params['language'], supported_languages, language_aliases)
query = u'language:{} {}'.format(lang.split('-')[0].upper(), query.decode('utf-8')).encode('utf-8')
diff --git a/searx/engines/bing_news.py b/searx/engines/bing_news.py
index 39048a1fc..669130c42 100644
--- a/searx/engines/bing_news.py
+++ b/searx/engines/bing_news.py
@@ -71,7 +71,10 @@ def request(query, params):
offset = (params['pageno'] - 1) * 10 + 1
- language = match_language(params['language'], supported_languages, language_aliases)
+ if params['language'] == 'all':
+ language = 'en-US'
+ else:
+ language = match_language(params['language'], supported_languages, language_aliases)
params['url'] = _get_url(query, language, offset, params['time_range'])
diff --git a/searx/engines/dailymotion.py b/searx/engines/dailymotion.py
index 8268b6257..06a9c41f3 100644
--- a/searx/engines/dailymotion.py
+++ b/searx/engines/dailymotion.py
@@ -33,7 +33,10 @@ supported_languages_url = 'https://api.dailymotion.com/languages'
# do search-request
def request(query, params):
- locale = match_language(params['language'], supported_languages)
+ if params['language'] == 'all':
+ locale = 'en-US'
+ else:
+ locale = match_language(params['language'], supported_languages)
params['url'] = search_url.format(
query=urlencode({'search': query, 'localization': locale}),
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 2c5dc50d8..fb8f523ac 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -54,6 +54,9 @@ content_xpath = './/a[@class="result__snippet"]'
# match query's language to a region code that duckduckgo will accept
def get_region_code(lang, lang_list=[]):
+ if lang == 'all':
+ return None
+
lang_code = match_language(lang, lang_list, language_aliases, 'wt-WT')
lang_parts = lang_code.split('-')
@@ -61,7 +64,6 @@ def get_region_code(lang, lang_list=[]):
return lang_parts[1].lower() + '-' + lang_parts[0].lower()
-# do search-request
def request(query, params):
if params['time_range'] and params['time_range'] not in time_range_dict:
return params
@@ -69,8 +71,12 @@ def request(query, params):
offset = (params['pageno'] - 1) * 30
region_code = get_region_code(params['language'], supported_languages)
- params['url'] = url.format(
- query=urlencode({'q': query, 'kl': region_code}), offset=offset, dc_param=offset)
+ if region_code:
+ params['url'] = url.format(
+ query=urlencode({'q': query, 'kl': region_code}), offset=offset, dc_param=offset)
+ else:
+ params['url'] = url.format(
+ query=urlencode({'q': query}), offset=offset, dc_param=offset)
if params['time_range'] in time_range_dict:
params['url'] += time_range_url.format(range=time_range_dict[params['time_range']])
diff --git a/searx/engines/duckduckgo_images.py b/searx/engines/duckduckgo_images.py
index 7905d0bcd..8c46ec92d 100644
--- a/searx/engines/duckduckgo_images.py
+++ b/searx/engines/duckduckgo_images.py
@@ -56,8 +56,12 @@ def request(query, params):
safesearch = params['safesearch'] - 1
region_code = get_region_code(params['language'], lang_list=supported_languages)
- params['url'] = images_url.format(
- query=urlencode({'q': query, 'l': region_code}), offset=offset, safesearch=safesearch, vqd=vqd)
+ if region_code:
+ params['url'] = images_url.format(
+ query=urlencode({'q': query, 'l': region_code}), offset=offset, safesearch=safesearch, vqd=vqd)
+ else:
+ params['url'] = images_url.format(
+ query=urlencode({'q': query}), offset=offset, safesearch=safesearch, vqd=vqd)
return params
diff --git a/searx/engines/faroo.py b/searx/engines/faroo.py
index 4e8b56743..a36ecf778 100644
--- a/searx/engines/faroo.py
+++ b/searx/engines/faroo.py
@@ -40,7 +40,10 @@ def request(query, params):
offset = (params['pageno'] - 1) * number_of_results + 1
categorie = search_category.get(params['category'], 'web')
- language = params['language'].split('-')[0]
+ if params['language'] == 'all':
+ language = 'en'
+ else:
+ language = params['language'].split('-')[0]
# if language is not supported, put it in english
if language != 'en' and\
diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py
index 9b9b9bd77..a6aa5d718 100644
--- a/searx/engines/gigablast.py
+++ b/searx/engines/gigablast.py
@@ -50,9 +50,12 @@ supported_languages_url = 'https://gigablast.com/search?&rxikd=1'
def request(query, params):
offset = (params['pageno'] - 1) * number_of_results
- language = params['language'].replace('-', '_').lower()
- if language.split('-')[0] != 'zh':
- language = language.split('-')[0]
+ if params['language'] == 'all':
+ language = 'xx'
+ else:
+ language = params['language'].replace('-', '_').lower()
+ if language.split('-')[0] != 'zh':
+ language = language.split('-')[0]
if params['safesearch'] >= 1:
safesearch = 1
diff --git a/searx/engines/google.py b/searx/engines/google.py
index 7a4390fc6..36ca7a116 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -166,7 +166,11 @@ def extract_text_from_dom(result, xpath):
def request(query, params):
offset = (params['pageno'] - 1) * 10
- language = match_language(params['language'], supported_languages, language_aliases)
+ if params['language'] == 'all' or params['language'] == 'en-US':
+ language = 'en-GB'
+ else:
+ language = match_language(params['language'], supported_languages, language_aliases)
+
language_array = language.split('-')
if params['language'].find('-') > 0:
country = params['language'].split('-')[1]
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index bf5995c88..9c837b45b 100644
--- a/searx/engines/google_news.py
+++ b/searx/engines/google_news.py
@@ -51,9 +51,10 @@ def request(query, params):
params['url'] = search_url.format(query=urlencode({'q': query}),
search_options=urlencode(search_options))
- language = match_language(params['language'], supported_languages, language_aliases).split('-')[0]
- if language:
- params['url'] += '&lr=lang_' + language
+ if params['language'] != 'all':
+ language = match_language(params['language'], supported_languages, language_aliases).split('-')[0]
+ if language:
+ params['url'] += '&lr=lang_' + language
return params
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py
index c7b05ffcd..0607ac93b 100644
--- a/searx/engines/mediawiki.py
+++ b/searx/engines/mediawiki.py
@@ -45,7 +45,10 @@ def request(query, params):
format_strings = list(Formatter().parse(base_url))
- language = params['language'].split('-')[0]
+ if params['language'] == 'all':
+ language = 'en'
+ else:
+ language = params['language'].split('-')[0]
# format_string [('https://', 'language', '', None), ('.wikipedia.org/', None, None, None)]
if any(x[1] == 'language' for x in format_strings):
diff --git a/searx/engines/photon.py b/searx/engines/photon.py
index 240841954..15236f680 100644
--- a/searx/engines/photon.py
+++ b/searx/engines/photon.py
@@ -35,9 +35,10 @@ def request(query, params):
search_string.format(query=urlencode({'q': query}),
limit=number_of_results)
- language = params['language'].split('-')[0]
- if language in supported_languages:
- params['url'] = params['url'] + "&lang=" + language
+ if params['language'] != 'all':
+ language = params['language'].split('_')[0]
+ if language in supported_languages:
+ params['url'] = params['url'] + "&lang=" + language
# using searx User-Agent
params['headers']['User-Agent'] = searx_useragent()
diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py
index 1bef07cc7..de12955c6 100644
--- a/searx/engines/qwant.py
+++ b/searx/engines/qwant.py
@@ -46,8 +46,9 @@ def request(query, params):
offset=offset)
# add language tag
- language = match_language(params['language'], supported_languages, language_aliases)
- params['url'] += '&locale=' + language.replace('-', '_').lower()
+ if params['language'] != 'all':
+ language = match_language(params['language'], supported_languages, language_aliases)
+ params['url'] += '&locale=' + language.replace('-', '_').lower()
return params
diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py
index 55efdc884..6638f3d83 100644
--- a/searx/engines/startpage.py
+++ b/searx/engines/startpage.py
@@ -46,8 +46,9 @@ def request(query, params):
params['data'] = {'query': query,
'startat': offset}
- # set language
- params['data']['with_language'] = ('lang_' + params['language'].split('-')[0])
+ # set language if specified
+ if params['language'] != 'all':
+ params['data']['with_language'] = ('lang_' + params['language'].split('-')[0])
return params
diff --git a/searx/engines/subtitleseeker.py b/searx/engines/subtitleseeker.py
index 118504ffd..2cbc991b3 100644
--- a/searx/engines/subtitleseeker.py
+++ b/searx/engines/subtitleseeker.py
@@ -48,7 +48,7 @@ def response(resp):
search_lang = 'Farsi'
elif resp.search_params['language'] == 'pt-BR':
search_lang = 'Brazilian'
- else:
+ elif resp.search_params['language'] != 'all':
search_lang = [lc[3]
for lc in language_codes
if lc[0].split('-')[0] == resp.search_params['language'].split('-')[0]]
diff --git a/searx/engines/swisscows.py b/searx/engines/swisscows.py
index 0001d56bf..e451bcffc 100644
--- a/searx/engines/swisscows.py
+++ b/searx/engines/swisscows.py
@@ -36,8 +36,12 @@ regex_img_url_remove_start = re.compile(b'^https?://i\.swisscows\.ch/\?link=')
# do search-request
def request(query, params):
- region = match_language(params['language'], supported_languages, language_aliases)
- ui_language = region.split('-')[0]
+ if params['language'] == 'all':
+ ui_language = 'browser'
+ region = 'browser'
+ else:
+ region = match_language(params['language'], supported_languages, language_aliases)
+ ui_language = region.split('-')[0]
search_path = search_string.format(
query=urlencode({'query': query, 'uiLanguage': ui_language, 'region': region}),
diff --git a/searx/engines/twitter.py b/searx/engines/twitter.py
index 8641167dc..d2a8d2088 100644
--- a/searx/engines/twitter.py
+++ b/searx/engines/twitter.py
@@ -37,7 +37,12 @@ timestamp_xpath = './/span[contains(@class,"_timestamp")]'
# do search-request
def request(query, params):
params['url'] = search_url + urlencode({'q': query})
- params['cookies']['lang'] = params['language'].split('-')[0]
+
+ # set language if specified
+ if params['language'] != 'all':
+ params['cookies']['lang'] = params['language'].split('-')[0]
+ else:
+ params['cookies']['lang'] = 'en'
return params
diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py
index 2485b6528..03a58a31a 100644
--- a/searx/engines/wikidata.py
+++ b/searx/engines/wikidata.py
@@ -68,7 +68,10 @@ def response(resp):
html = fromstring(resp.text)
search_results = html.xpath(wikidata_ids_xpath)
- language = match_language(resp.search_params['language'], supported_languages, language_aliases).split('-')[0]
+ if resp.search_params['language'].split('-')[0] == 'all':
+ language = 'en'
+ else:
+ language = match_language(resp.search_params['language'], supported_languages, language_aliases).split('-')[0]
# TODO: make requests asynchronous to avoid timeout when result_count > 1
for search_result in search_results[:result_count]:
diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py
index 23f23db4d..39aec1c81 100644
--- a/searx/engines/wikipedia.py
+++ b/searx/engines/wikipedia.py
@@ -31,6 +31,9 @@ supported_languages_url = 'https://meta.wikimedia.org/wiki/List_of_Wikipedias'
# set language in base_url
def url_lang(lang):
+ lang_pre = lang.split('-')[0]
+ if lang_pre == 'all' or lang_pre not in supported_languages:
+ return 'en'
return match_language(lang, supported_languages, language_aliases).split('-')[0]
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 7c307ce53..25bc83687 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -51,7 +51,9 @@ def request(query, params):
limit=number_of_results,
search_type=search_type)
- params['url'] += '&lr=lang_' + params['language'].split('-')[0]
+ # add language tag if specified
+ if params['language'] != 'all':
+ params['url'] += '&lr=lang_' + params['language'].split('-')[0]
return params
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py
index ba4cb6af8..73b78bcf7 100644
--- a/searx/engines/yahoo.py
+++ b/searx/engines/yahoo.py
@@ -73,16 +73,25 @@ def _get_url(query, offset, language, time_range):
lang=language)
+def _get_language(params):
+ if params['language'] == 'all':
+ return 'en'
+
+ language = match_language(params['language'], supported_languages, language_aliases)
+ if language not in language_aliases.values():
+ language = language.split('-')[0]
+ language = language.replace('-', '_').lower()
+
+ return language
+
+
# do search-request
def request(query, params):
if params['time_range'] and params['time_range'] not in time_range_dict:
return params
offset = (params['pageno'] - 1) * 10 + 1
- language = match_language(params['language'], supported_languages, language_aliases)
- if language not in language_aliases.values():
- language = language.split('-')[0]
- language = language.replace('-', '_').lower()
+ language = _get_language(params)
params['url'] = _get_url(query, offset, language, params['time_range'])
diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py
index b61384d06..9f6a4159b 100644
--- a/searx/engines/yahoo_news.py
+++ b/searx/engines/yahoo_news.py
@@ -41,7 +41,10 @@ suggestion_xpath = '//div[contains(@class,"VerALSOTRY")]//a'
def request(query, params):
offset = (params['pageno'] - 1) * 10 + 1
- language = match_language(params['language'], supported_languages, language_aliases).split('-')[0]
+ if params['language'] == 'all':
+ language = 'en'
+ else:
+ language = match_language(params['language'], supported_languages, language_aliases).split('-')[0]
params['url'] = search_url.format(offset=offset,
query=urlencode({'p': query}),
diff --git a/searx/engines/youtube_api.py b/searx/engines/youtube_api.py
index f8bc353f4..6de18aa2c 100644
--- a/searx/engines/youtube_api.py
+++ b/searx/engines/youtube_api.py
@@ -34,7 +34,9 @@ def request(query, params):
params['url'] = search_url.format(query=urlencode({'q': query}),
api_key=api_key)
- params['url'] += '&relevanceLanguage=' + params['language'].split('-')[0]
+ # add language tag if specified
+ if params['language'] != 'all':
+ params['url'] += '&relevanceLanguage=' + params['language'].split('-')[0]
return params
diff --git a/searx/preferences.py b/searx/preferences.py
index ed2cc402a..acaa67f66 100644
--- a/searx/preferences.py
+++ b/searx/preferences.py
@@ -12,6 +12,7 @@ if version[0] == '3':
COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5 # 5 years
LANGUAGE_CODES = [l[0] for l in languages]
+LANGUAGE_CODES.append('all')
DISABLED = 0
ENABLED = 1
DOI_RESOLVERS = list(settings['doi_resolvers'])
diff --git a/searx/search.py b/searx/search.py
index 950a49f23..2b7151e65 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -24,7 +24,7 @@ from flask_babel import gettext
import requests.exceptions
import searx.poolrequests as requests_lib
from searx.engines import (
- categories, engines, settings
+ categories, engines
)
from searx.answerers import ask
from searx.utils import gen_useragent
@@ -221,10 +221,6 @@ def get_search_query_from_webapp(preferences, form):
else:
query_lang = preferences.get_value('language')
- # provides backwards compatibility for requests using old language default
- if query_lang == 'all':
- query_lang = settings['search']['language']
-
# check language
if not VALID_LANGUAGE_CODE.match(query_lang):
raise SearxParameterException('language', query_lang)
diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml
index e5f163aef..070a0edb6 100644
--- a/searx/settings_robot.yml
+++ b/searx/settings_robot.yml
@@ -5,7 +5,7 @@ general:
search:
safe_search : 0
autocomplete : ""
- language: "en-US"
+ language: "all"
server:
port : 11111
diff --git a/searx/templates/courgette/preferences.html b/searx/templates/courgette/preferences.html
index 61f521477..56a6e0202 100644
--- a/searx/templates/courgette/preferences.html
+++ b/searx/templates/courgette/preferences.html
@@ -13,6 +13,7 @@
<legend>{{ _('Search language') }}</legend>
<p>
<select name='language'>
+ <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
{% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
{% endfor %}
diff --git a/searx/templates/legacy/preferences.html b/searx/templates/legacy/preferences.html
index fb70832e3..f418dcd5b 100644
--- a/searx/templates/legacy/preferences.html
+++ b/searx/templates/legacy/preferences.html
@@ -14,6 +14,7 @@
<legend>{{ _('Search language') }}</legend>
<p>
<select name='language'>
+ <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
{% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
{% endfor %}
diff --git a/searx/templates/oscar/languages.html b/searx/templates/oscar/languages.html
index 369abca83..53ade43b2 100644
--- a/searx/templates/oscar/languages.html
+++ b/searx/templates/oscar/languages.html
@@ -3,9 +3,10 @@
{% else %}
<select class="time_range custom-select form-control" id='language' name='language'>
{% endif %}
- {% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
- <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>
- {{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}
- </option>
- {% endfor %}
+ <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
+ {% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
+ <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>
+ {{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}
+ </option>
+ {% endfor %}
</select>
diff --git a/searx/templates/pix-art/preferences.html b/searx/templates/pix-art/preferences.html
index 0b2bb6709..05876dedf 100644
--- a/searx/templates/pix-art/preferences.html
+++ b/searx/templates/pix-art/preferences.html
@@ -9,6 +9,7 @@
<legend>{{ _('Search language') }}</legend>
<p>
<select name='language'>
+ <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
{% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
<option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}</option>
{% endfor %}
diff --git a/searx/webapp.py b/searx/webapp.py
index 7145caca9..977e7e675 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -637,8 +637,8 @@ def autocompleter():
if len(raw_results) <= 3 and completer:
# get language from cookie
language = request.preferences.get_value('language')
- if not language:
- language = settings['search']['language']
+ if not language or language == 'all':
+ language = 'en'
else:
language = language.split('-')[0]
# run autocompletion
@@ -691,10 +691,7 @@ def preferences():
'warn_time': False}
if e.timeout > settings['outgoing']['request_timeout']:
stats[e.name]['warn_timeout'] = True
- if match_language(request.preferences.get_value('language'),
- getattr(e, 'supported_languages', []),
- getattr(e, 'language_aliases', {}), None):
- stats[e.name]['supports_selected_language'] = True
+ stats[e.name]['supports_selected_language'] = _is_selected_language_supported(e, request.preferences)
# get first element [0], the engine time,
# and then the second element [1] : the time (the first one is the label)
@@ -725,6 +722,14 @@ def preferences():
preferences=True)
+def _is_selected_language_supported(engine, preferences):
+ language = preferences.get_value('language')
+ return (language == 'all'
+ or match_language(language,
+ getattr(engine, 'supported_languages', []),
+ getattr(engine, 'language_aliases', {}), None))
+
+
@app.route('/image_proxy', methods=['GET'])
def image_proxy():
url = request.args.get('url').encode('utf-8')