on master help sign in
[enh] language selection from query
commita641971a6f1be82e16c7e969c91148cc1c83c31b authorasciimoo <asciimoo@gmail.com> dateSun 9 Feb 2014, 01:22 (13 years ago) parent7f45e8a
1 file changed+6−1
searx/search.py+6−1
searx/search.py+6−1
@@ -77,7 +77,12 @@ class Search(object):
7777 def parse_query(self):
7878 query_parts = self.query.split()
7979 modified = False
80− if query_parts[0].startswith('!'):
80+ if query_parts[0].startswith(':'):
81+ lang = query_parts[0][1:]
82+ if lang in (x[0] for x in language_codes):
83+ self.lang = lang
84+ modified = True
85+ elif query_parts[0].startswith('!'):
8186 prefix = query_parts[0][1:].replace('_', ' ')
8287 if prefix in engine_shortcuts\
8388 and not engine_shortcuts[prefix] in self.blocked_engines: