summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2022-12-16 20:28:57 +0000
committerAlexandre Flament <alex@al-f.net>2023-02-17 15:17:36 +0000
commit6748e8e2d5eff3c2202b2a714afb5534b1573101 (patch)
tree57f6fcf3d5b9bb5ee3b4a03aaf8aac2a53ee7106 /searx/webapp.py
parent54389a29feb3feea5a868f7b3b83c9718fb71014 (diff)
downloadsearxng-6748e8e2d5eff3c2202b2a714afb5534b1573101.tar.gz
searxng-6748e8e2d5eff3c2202b2a714afb5534b1573101.zip
Add "Auto-detected" as a language.
When the user choose "Auto-detected", the choice remains on the following queries. The detected language is displayed. For example "Auto-detected (en)": * the next query language is going to be auto detected * for the current query, the detected language is English. This replace the autodetect_search_language plugin.
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 6746f7a00..95c33f704 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -810,6 +810,9 @@ def search():
)
)
+ # search_query.lang contains the user choice (all, auto, en, ...)
+ # when the user choice is "auto", search.search_query.lang contains the detected language
+ # otherwise it is equals to search_query.lang
return render(
# fmt: off
'results.html',
@@ -834,6 +837,11 @@ def search():
settings['search']['languages'],
fallback=request.preferences.get_value("language")
),
+ search_language = match_language(
+ search.search_query.lang,
+ settings['search']['languages'],
+ fallback=request.preferences.get_value("language")
+ ),
timeout_limit = request.form.get('timeout_limit', None)
# fmt: on
)