summaryrefslogtreecommitdiffhomepage
path: root/gui/scripts
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-10-10 15:51:44 +0200
committerAndrej Mihajlov <and@mullvad.net>2019-10-14 13:52:07 +0200
commit6767f8be9860f9b9c6002b18ccdac38439114d6f (patch)
tree5af196a0b971a4cc2fd14716799b6330340bb39f /gui/scripts
parent240d707bb23e7571badba414f892bae047d68185 (diff)
downloadmullvadvpn-6767f8be9860f9b9c6002b18ccdac38439114d6f.tar.xz
mullvadvpn-6767f8be9860f9b9c6002b18ccdac38439114d6f.zip
Enable checks for duplicate entries
Diffstat (limited to 'gui/scripts')
-rw-r--r--gui/scripts/extract-geo-data.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/gui/scripts/extract-geo-data.py b/gui/scripts/extract-geo-data.py
index 9cdd329215..0719dfc92e 100644
--- a/gui/scripts/extract-geo-data.py
+++ b/gui/scripts/extract-geo-data.py
@@ -153,7 +153,7 @@ def extract_countries_po():
if os.path.isdir(locale_dir):
with fiona.open(input_path) as source:
- po = POFile(encoding='utf-8')
+ po = POFile(encoding='utf-8', check_for_duplicates=True)
po.metadata = {"Content-Type": "text/plain; charset=utf-8"}
output_path = path.join(locale_out_dir, "countries.po")
@@ -226,7 +226,7 @@ def extract_cities_po():
locale_out_dir = path.join(LOCALE_OUT_DIR, locale)
if os.path.isdir(locale_dir):
- po = POFile(encoding='utf-8')
+ po = POFile(encoding='utf-8', check_for_duplicates=True)
po.metadata = {"Content-Type": "text/plain; charset=utf-8"}
output_path = path.join(locale_out_dir, "cities.po")
hits = 0
@@ -259,10 +259,14 @@ def extract_cities_po():
)
entry = POEntry(
- msgid=props["name"],
+ msgid=props.get("name"),
msgstr=translated_name
)
- po.append(entry)
+
+ try:
+ po.append(entry)
+ except ValueError as err:
+ print c.orange(u"Cannot add an entry: {}".format(err))
sort_pofile_entries(po)
po.save(output_path)
@@ -297,7 +301,7 @@ def extract_relay_translations():
def extract_relay_locations_pot(countries):
- pot = POFile(encoding='utf-8')
+ pot = POFile(encoding='utf-8', check_for_duplicates=True)
pot.metadata = {"Content-Type": "text/plain; charset=utf-8"}
output_path = path.join(LOCALE_OUT_DIR, "relay-locations.pot")
@@ -362,7 +366,7 @@ def translate_relay_locations_pot(countries):
def translate_relay_locations(place_translator, countries, locale):
- po = POFile(encoding='utf-8')
+ po = POFile(encoding='utf-8', check_for_duplicates=True)
po.metadata = {"Content-Type": "text/plain; charset=utf-8"}
locale_out_dir = path.join(LOCALE_OUT_DIR, locale)
output_path = path.join(locale_out_dir, "relay-locations.po")