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

i18n: Fallback to english in retrieve_country_name #612

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions eduvpn/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

CLIENT_ID = "org.eduvpn.app.linux"
LETSCONNECT_CLIENT_ID = "org.letsconnect-vpn.app.linux"
LANGUAGE = "nl"
COUNTRY = "nl-NL"
LANGUAGE = "en"
COUNTRY = "en-EN"

COUNTRY_MAP = Path(prefix + "/share/eduvpn/country_codes.json")
FLAG_PREFIX = prefix + "/share/eduvpn/images/flags/png/"
Expand Down
Loading