34def response(resp):
35 translation = resp.json()
36
37 infobox = ""
38
39 if translation['target_transliteration'] and not re.match(
40 re_transliteration_unsupported, translation['target_transliteration']
41 ):
42 infobox = f"<b>{translation['target_transliteration']}</b>"
43
44 if translation['word_choices']:
45 for word in translation['word_choices']:
46 infobox += f"<dl><dt>{word['word']}</dt>"
47
48 for example in word['examples_target']:
49 infobox += f"<dd>{re.sub(r'<|>', '', example)}</dd>"
50
51 infobox += "</dl>"
52
53 result = {
54 'infobox': translation['translated-text'],
55 'content': infobox,
56 }
57
58 return [result]