Skip to content

Commit

Permalink
Fix to always edit the default language in TTW editor
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Jul 1, 2014
1 parent dde3171 commit 7055ffc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/collective/taxonomy/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ def importJson(self):
self.taxonomy.data[language][key] = value

def generateJson(self, root):
# XXX: Support multiple languages
language = (self.taxonomy.default_language or '').split('-')[0]

item = {}
item['key'] = root.find('termIdentifier').text
item['title'] = root.find('caption').find('langstring').text
for langstring in root.find('caption').findall('langstring'):
if not 'title' in item:
item['title'] = langstring.text
elif langstring.attrib.get('language') == language:
item['title'] = langstring.text
break
item['isFolder'] = True
item['children'] = []

Expand Down

0 comments on commit 7055ffc

Please sign in to comment.