1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

[fix] handle weights in accept language parsing - fixes w3ms en;q=1.0

This commit is contained in:
Adam Tauber 2020-03-16 00:22:15 +01:00
parent 8e727ac77f
commit baca55c94e

View File

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