From 08c2e263f55d92296c5950a0b5de57ef4e8716a4 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Sat, 17 Jan 2015 20:38:46 +0100 Subject: [PATCH] [enh] configurable default interface locale - #177 --- searx/settings.yml | 1 + searx/webapp.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/searx/settings.yml b/searx/settings.yml index 49c0baca0..9be8bc50d 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -9,6 +9,7 @@ server: https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py useragent_suffix : "" # suffix of searx_useragent, could contain informations like an email address to the administrator image_proxy : False # Proxying image results through searx + default_locale : "" # Default interface locale - leave blank to detect from browser information engines: - name : wikipedia diff --git a/searx/webapp.py b/searx/webapp.py index 072baa52d..41bad5ea6 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -97,6 +97,9 @@ cookie_max_age = 60 * 60 * 24 * 365 * 23 # 23 years def get_locale(): locale = request.accept_languages.best_match(settings['locales'].keys()) + if settings['server'].get('default_locale'): + locale = settings['server']['default_locale'] + if request.cookies.get('locale', '') in settings['locales']: locale = request.cookies.get('locale', '')