mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 02:40:11 +01:00
[enh] language selection from query
This commit is contained in:
parent
7f45e8a562
commit
a641971a6f
@ -77,7 +77,12 @@ class Search(object):
|
|||||||
def parse_query(self):
|
def parse_query(self):
|
||||||
query_parts = self.query.split()
|
query_parts = self.query.split()
|
||||||
modified = False
|
modified = False
|
||||||
if query_parts[0].startswith('!'):
|
if query_parts[0].startswith(':'):
|
||||||
|
lang = query_parts[0][1:]
|
||||||
|
if lang in (x[0] for x in language_codes):
|
||||||
|
self.lang = lang
|
||||||
|
modified = True
|
||||||
|
elif query_parts[0].startswith('!'):
|
||||||
prefix = query_parts[0][1:].replace('_', ' ')
|
prefix = query_parts[0][1:].replace('_', ' ')
|
||||||
if prefix in engine_shortcuts\
|
if prefix in engine_shortcuts\
|
||||||
and not engine_shortcuts[prefix] in self.blocked_engines:
|
and not engine_shortcuts[prefix] in self.blocked_engines:
|
||||||
|
Loading…
Reference in New Issue
Block a user