mirror of https://github.com/searxng/searxng.git
Compare commits
No commits in common. "ee3c5e7752ced3735187f54576ed49ae190fd339" and "0ceb2563d233f618ae29c2568acd1bc80bcc58dc" have entirely different histories.
ee3c5e7752
...
0ceb2563d2
|
@ -217,7 +217,7 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
|
||||||
locale = babel.Locale.parse(searxng_locale, sep='-')
|
locale = babel.Locale.parse(searxng_locale, sep='-')
|
||||||
except babel.core.UnknownLocaleError:
|
except babel.core.UnknownLocaleError:
|
||||||
try:
|
try:
|
||||||
locale = babel.Locale.parse(searxng_locale.split('-')[0])
|
locale = babel.Locale.parse(searxng_locale.split('-')[1])
|
||||||
except babel.core.UnknownLocaleError:
|
except babel.core.UnknownLocaleError:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
@ -252,12 +252,8 @@ 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)
|
||||||
|
|
Loading…
Reference in New Issue