[fix] get_engine_locale: better approximation of 'en' is 'en-US'

Compared to `en-EN` the better approximation of 'en' is 'en-US'.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-08-14 15:45:07 +02:00
parent ac7776663b
commit de1e7d12f7
1 changed files with 4 additions and 0 deletions

View File

@ -252,8 +252,12 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
terr_lang_dict[territory] = langs.get(searxng_lang) terr_lang_dict[territory] = langs.get(searxng_lang)
# first: check fr-FR, de-DE .. is supported by the engine # first: check fr-FR, de-DE .. is supported by the engine
# exception: 'en' --> 'en-US'
territory = locale.language.upper() territory = locale.language.upper()
if territory == 'EN':
territory = 'US'
if terr_lang_dict.get(territory): if terr_lang_dict.get(territory):
searxng_locale = locale.language + '-' + territory searxng_locale = locale.language + '-' + territory
engine_locale = engine_locales.get(searxng_locale) engine_locale = engine_locales.get(searxng_locale)