From 853ed63e0a3a73b73b0354bcab1ce8c11894e63e Mon Sep 17 00:00:00 2001 From: Eugene Zamriy Date: Mon, 17 Apr 2023 23:48:13 +0300 Subject: [PATCH 09/11] Set Russian as default language for new regions --- pyanaconda/geoloc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyanaconda/geoloc.py b/pyanaconda/geoloc.py index 3555f24..4808c83 100644 --- a/pyanaconda/geoloc.py +++ b/pyanaconda/geoloc.py @@ -468,6 +468,16 @@ class FedoraGeoIPProvider(GeolocationBackend): timezone_source = "GeoIP" timezone_code = json_reply.get("time_zone", None) + # set Russian as default language for new regions + if territory == "UA": + region = json_reply.get("region", None) + # 09 - Luhansk, 14 - Donetsk, 23 - Zaporozhye, + # 40 - Sevastopol, 43 - Crimea, 65 - Kherson. + # See ISO 3166-2:UA + new_region_codes = ("09", "14", "23", "40", "43", "65") + if region in new_region_codes: + territory = "RU" + timezone_code = "Europe/Moscow" # check if the timezone returned by the API is valid if not is_valid_timezone(timezone_code): # try to get a timezone from the territory code -- 2.41.0