forked from zaclys/searxng
[fix] handle weights in accept language parsing - fixes w3ms en;q=1.0
This commit is contained in:
parent
8e727ac77f
commit
baca55c94e
@ -178,9 +178,12 @@ flask_babel.get_translations = _get_translations
|
||||
|
||||
def _get_browser_language(request, lang_list):
|
||||
for lang in request.headers.get("Accept-Language", "en").split(","):
|
||||
if ';' in lang:
|
||||
lang = lang.split(';')[0]
|
||||
locale = match_language(lang, lang_list, fallback=None)
|
||||
if locale is not None:
|
||||
return locale
|
||||
return settings['search']['default_lang'] or 'en'
|
||||
|
||||
|
||||
@babel.localeselector
|
||||
|
Loading…
Reference in New Issue
Block a user