[enh] configurable default interface locale - #177

This commit is contained in:
Adam Tauber 2015-01-17 20:38:46 +01:00
parent 317bce74dd
commit 08c2e263f5
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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', '')