summaryrefslogtreecommitdiffhomepage
path: root/gui/scripts
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-10-15 10:46:26 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-10-20 13:08:04 +0200
commit21378842fab0421f83c28c3d615de597dce107f5 (patch)
tree94ed3d626b995883018b5a2b001074c04c2ab989 /gui/scripts
parent8ee91cd6025282b1b03b4e17e4bdfe7f3cf51d61 (diff)
downloadmullvadvpn-21378842fab0421f83c28c3d615de597dce107f5.tar.xz
mullvadvpn-21378842fab0421f83c28c3d615de597dce107f5.zip
Reduce output in extract-geo-data script
The large amounts of output in the `extract-geo-data.py` script makes it difficult to spot real errors. Reducing the amount of output saying whether or not a translation was found and which one is being translated will make it easier to follow the output and make it easier to spot more critical errors.
Diffstat (limited to 'gui/scripts')
-rwxr-xr-xgui/scripts/extract-geo-data.py34
1 files changed, 3 insertions, 31 deletions
diff --git a/gui/scripts/extract-geo-data.py b/gui/scripts/extract-geo-data.py
index cb18ee040a..2198a6f7e0 100755
--- a/gui/scripts/extract-geo-data.py
+++ b/gui/scripts/extract-geo-data.py
@@ -164,7 +164,6 @@ def extract_relay_locations_pot(countries):
comment=country_code.upper()
)
pot.append(entry)
- print("{} ({})".format(country["name"], country.get("code")))
cities = country["cities"]
for city_code in cities:
@@ -179,8 +178,6 @@ def extract_relay_locations_pot(countries):
except ValueError as err:
print(c.orange("Cannot add an entry: {}".format(err)))
- print("{} ({})".format(city["name"], city["code"]))
-
pot.save(output_path)
@@ -258,20 +255,13 @@ def translate_single_relay_locations(country_translator, city_translator, countr
country_name = country["name"]
translated_country_name = country_translator.translate(locale, country_code)
- found_country_translation = translated_country_name is not None
# Default to empty string if no translation was found
- if found_country_translation:
+ if translated_country_name is not None:
hits += 1
else:
translated_country_name = ""
misses += 1
- log_message = "{} ({}) -> \"{}\"".format(country_name, country_code, translated_country_name)
- if found_country_translation:
- print(c.green(log_message))
- else:
- print(c.orange(log_message))
-
# translate country
entry = POEntry(
msgid=country_name,
@@ -303,12 +293,6 @@ def translate_single_relay_locations(country_translator, city_translator, countr
translated_name = ""
misses += 1
- log_message = "{} ({}) -> \"{}\"".format(city_name, city_code, translated_name)
- if found_translation:
- print(c.green(log_message))
- else:
- print(c.orange(log_message))
-
entry = POEntry(
msgid=city_name,
msgstr=translated_name,
@@ -348,13 +332,7 @@ class CountryTranslator:
if props is not None:
name_key = "name_" + map_locale(locale)
- value = props.get(name_key)
-
- if value is None:
- print(c.orange("Missing translation for {} ({}) under the {} key"
- .format(iso_a2, locale, name_key)))
- else:
- return value
+ return props.get(name_key)
return None
@@ -401,13 +379,7 @@ class CityTranslator:
if props is not None:
name_key = "name_" + map_locale(locale)
- value = props.get(name_key)
-
- if value is None:
- print(c.orange("Missing translation for {} ({}) under the {} key"
- .format(english_name, locale, name_key)))
- else:
- return value
+ return props.get(name_key)
return None