Skip to content

Commit

Permalink
provisional handling of multi-lingual code names; see #3
Browse files Browse the repository at this point in the history
tanius committed Oct 21, 2019
1 parent 4622a36 commit f5754b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions importer/importFromDiscourse.py
Original file line number Diff line number Diff line change
@@ -373,6 +373,14 @@ def create_tags(self):
for tag in tag_json:
# create tag if not existing
if not(tag['id'] in self.existing_elements['tags']):

# Take the English code name as its name, ignoring codes without an English name.
english_name = [i18n_name['name'] for i18n_name in tag['names'] if i18n_name['locale'] == 'en']
if english_name == []:
continue
else:
tag['name'] = english_name[0]

if not(tag['name'].lower() in self.tags):
self.createTag(tag['id'], tag['name'].lower())
self.map_tag_to_tag[tag['id']] = tag['id']

0 comments on commit f5754b9

Please sign in to comment.