mirror of https://github.com/searxng/searxng.git
[fix] fix language support in photon engine
This commit is contained in:
parent
667f4d5cfc
commit
533e6287ae
|
@ -23,6 +23,9 @@ base_url = 'https://photon.komoot.de/'
|
||||||
search_string = 'api/?{query}&limit={limit}'
|
search_string = 'api/?{query}&limit={limit}'
|
||||||
result_base_url = 'https://openstreetmap.org/{osm_type}/{osm_id}'
|
result_base_url = 'https://openstreetmap.org/{osm_type}/{osm_id}'
|
||||||
|
|
||||||
|
# list of supported languages
|
||||||
|
allowed_languages = ['de', 'en', 'fr', 'it']
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -31,8 +34,9 @@ def request(query, params):
|
||||||
limit=number_of_results)
|
limit=number_of_results)
|
||||||
|
|
||||||
if params['language'] != 'all':
|
if params['language'] != 'all':
|
||||||
params['url'] = params['url'] +\
|
language = params['language'].split('_')[0]
|
||||||
"&lang=" + params['language'].replace('_', '-')
|
if language in allowed_languages:
|
||||||
|
params['url'] = params['url'] + "&lang=" + language
|
||||||
|
|
||||||
# using searx User-Agent
|
# using searx User-Agent
|
||||||
params['headers']['User-Agent'] = searx_useragent()
|
params['headers']['User-Agent'] = searx_useragent()
|
||||||
|
|
Loading…
Reference in New Issue