summaryrefslogtreecommitdiff
path: root/searx/query.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-12-29 10:41:14 +0100
committerGitHub <noreply@github.com>2016-12-29 10:41:14 +0100
commitd08108be6293c8764f0d1d950a7aab283cddffed (patch)
tree8c56885e21ec92109bfaaadca2af3a43b5f7c11d /searx/query.py
parent7388067f1546f560830a25d0082c0ab9fc1cba34 (diff)
parent896c0c3734ae369eca4ba9592595e1b5395dbc88 (diff)
Merge pull request #794 from a01200356/languages
Changes in search language list (continuation of #748)
Diffstat (limited to 'searx/query.py')
-rw-r--r--searx/query.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/query.py b/searx/query.py
index dcef1924d..4a4e5a192 100644
--- a/searx/query.py
+++ b/searx/query.py
@@ -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: