summaryrefslogtreecommitdiffhomepage
path: root/gui/scripts
diff options
context:
space:
mode:
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")