diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-12-17 21:26:46 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-12-17 21:26:46 -0800 |
commit | 5be864bb6f1f911bec143566c768bf735a373743 (patch) | |
tree | 8f87276459e03e306c9f737f2d2278f77d917ad5 /ext/bg/js/translator.js | |
parent | 5c755043fa2fb23f94f898fc57828277d7b02049 (diff) |
WIP
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 13bf1427..726922ac 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -137,19 +137,7 @@ class Translator { continue; } - const tagItems = []; - for (const tag of definition.tags) { - const tagItem = { - name: tag, - category: 'default', - order: Number.MAX_SAFE_INTEGER, - notes: '' - }; - - applyTagMeta(tagItem, definition.tagMeta); - tagItems.push(tagItem); - } - + const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta)); groups[definition.id] = { source, reasons, @@ -157,7 +145,7 @@ class Translator { expression: definition.expression, reading: definition.reading, glossary: definition.glossary, - tags: sortTags(tagItems) + tags: sortTags(tags) }; } }); @@ -165,20 +153,8 @@ class Translator { processKanji(definitions) { for (const definition of definitions) { - const tagItems = []; - for (const tag of definition.tags) { - const tagItem = { - name: tag, - category: 'default', - order: Number.MAX_SAFE_INTEGER, - notes: '' - }; - - applyTagMeta(tagItem, definition.tagMeta); - tagItems.push(tagItem); - } - - definition.tags = sortTags(tagItems); + const tags = definitions.tags.map(tag => buildTag(tag, definition.tagMeta)); + definition.tags = sortTags(tags); } return definitions; |