forked from Ponysearch/Ponysearch
[enh] configurable default interface locale - #177
This commit is contained in:
parent
317bce74dd
commit
08c2e263f5
2 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,7 @@ server:
|
||||||
https_rewrite : True # Force rewrite result urls. See searx/https_rewrite.py
|
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
|
useragent_suffix : "" # suffix of searx_useragent, could contain informations like an email address to the administrator
|
||||||
image_proxy : False # Proxying image results through searx
|
image_proxy : False # Proxying image results through searx
|
||||||
|
default_locale : "" # Default interface locale - leave blank to detect from browser information
|
||||||
|
|
||||||
engines:
|
engines:
|
||||||
- name : wikipedia
|
- name : wikipedia
|
||||||
|
|
|
@ -97,6 +97,9 @@ cookie_max_age = 60 * 60 * 24 * 365 * 23 # 23 years
|
||||||
def get_locale():
|
def get_locale():
|
||||||
locale = request.accept_languages.best_match(settings['locales'].keys())
|
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']:
|
if request.cookies.get('locale', '') in settings['locales']:
|
||||||
locale = request.cookies.get('locale', '')
|
locale = request.cookies.get('locale', '')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue