Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
i18n: Fallback to english in retrieve_country_name
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijenbergh committed Nov 19, 2024
1 parent 466e38f commit f264ec9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions eduvpn/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,9 @@ def extract_translation(d: Union[str, Dict[str, str]]):

def retrieve_country_name(country_code: str) -> str:
country_map = _read_country_map()
loc = locale.getlocale()
if loc[0] is None:
prefix = "en"
else:
prefix = loc[0][:2]
if country_code in country_map:
code = country_map[country_code]
if prefix in code:
return code[prefix]
return country_code
if country_code not in country_map:
return country_code
return extract_translation(country_map[country_code])


def _read_country_map() -> dict:
Expand Down

0 comments on commit f264ec9

Please sign in to comment.