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:
@@ -24,6 +24,8 @@ from searx.engines import (
|
||||
import string
|
||||
import re
|
||||
|
||||
VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(\-[A-Z]{2})?$')
|
||||
|
||||
|
||||
class RawTextQuery(object):
|
||||
"""parse raw text query (the value from the html input)"""
|
||||
@@ -68,6 +70,11 @@ class RawTextQuery(object):
|
||||
if query_part[0] == ':':
|
||||
lang = query_part[1:].lower()
|
||||
|
||||
# user may set a valid, yet not selectable language
|
||||
if VALID_LANGUAGE_CODE.match(lang):
|
||||
self.languages.append(lang)
|
||||
parse_next = True
|
||||
|
||||
# check if any language-code is equal with
|
||||
# declared language-codes
|
||||
for lc in language_codes:
|
||||
|
||||
Reference in New Issue
Block a user