diff options
author | asciimoo <asciimoo@gmail.com> | 2014-02-09 01:22:30 +0100 |
---|---|---|
committer | asciimoo <asciimoo@gmail.com> | 2014-02-09 01:22:30 +0100 |
commit | a641971a6f1be82e16c7e969c91148cc1c83c31b (patch) | |
tree | d0483ec5c4386604184ce1d45e4b0924f1d3ac6d /searx/search.py | |
parent | 7f45e8a562ea6a57ab9126b99cba87b9a40bfaa7 (diff) | |
download | searxng-a641971a6f1be82e16c7e969c91148cc1c83c31b.tar.gz searxng-a641971a6f1be82e16c7e969c91148cc1c83c31b.zip |
[enh] language selection from query
Diffstat (limited to 'searx/search.py')
-rw-r--r-- | searx/search.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/search.py b/searx/search.py index fb9cb2f7b..29556bb43 100644 --- a/searx/search.py +++ b/searx/search.py @@ -77,7 +77,12 @@ class Search(object): def parse_query(self): query_parts = self.query.split() 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('_', ' ') if prefix in engine_shortcuts\ and not engine_shortcuts[prefix] in self.blocked_engines: |