mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
change language list to only include languages with a minimum of engines
that support them. users can still query lesser supported through the :lang_code bang.
This commit is contained in:
@@ -95,8 +95,13 @@ def _fetch_supported_languages(resp):
|
||||
dom = fromstring(resp.text)
|
||||
links = dom.xpath('//span[@id="menu2"]/a')
|
||||
for link in links:
|
||||
code = link.xpath('./@href')[0][-2:]
|
||||
if code != 'xx' and code not in supported_languages:
|
||||
href = link.xpath('./@href')[0].split('lang%3A')
|
||||
if len(href) == 2:
|
||||
code = href[1].split('_')
|
||||
if len(code) == 2:
|
||||
code = code[0] + '-' + code[1].upper()
|
||||
else:
|
||||
code = code[0]
|
||||
supported_languages.append(code)
|
||||
|
||||
return supported_languages
|
||||
|
||||
Reference in New Issue
Block a user