[fix] don't show flags for languages without region identifier

SearXNG shows two different things:

region:
  "de-CH" is the equivalent of "Schweiz (de)" in DDG.

languages:
  "en" doesn't say anything about the location. It is up the engines to do their
  best to select English results without a region.

Suggested-by: @dalf https://github.com/searxng/searxng/pull/967#issuecomment-1072979693
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-03-19 12:14:07 +01:00
parent 2841abaf55
commit a25e3767d4
2 changed files with 17 additions and 13 deletions

View file

@ -68,7 +68,6 @@ lang2emoji = {
'jp': '\U0001F1EF\U0001F1F5', # Japanese
'ua': '\U0001F1FA\U0001F1E6', # Ukrainian
'he': '\U0001F1EE\U0001F1F7', # Hebrew
'zh': '\U0001F1E8\U0001F1F3', # China (zh)
}
@ -80,11 +79,7 @@ def get_unicode_flag(lang_code):
return emoji
if len(lang_code) == 2:
l_code = lang_code.lower()
c_code = lang_code.upper()
if c_code == 'EN':
c_code = 'GB'
lang_code = "%s-%s" % (l_code, c_code)
return '\U0001F310'
language = territory = script = variant = ''
try: