diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-08 11:18:55 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-08 11:18:55 -0800 |
commit | d7b4aa681c4ade5fe2bf838b3f7c6e44737e8ab1 (patch) | |
tree | fd7d8f63ace566f46f521344d583bd7a1ab991f0 /ext/bg/js/translator.js | |
parent | a5efe5032247162e2a88554d39110ae1270544a8 (diff) |
fixing dictionary tags
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 374c6087..bdd606b7 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -55,12 +55,7 @@ class Translator { for (const deinflection of deinflections) { for (const definition of deinflection.definitions) { const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta)); - tags.push(sanitizeTag({ - name: definition.dictionary, - category: 'dictionary', - order: 100 - })); - + tags.push(buildDictTag(definition.dictionary)); definitions.push({ source: deinflection.source, reasons: deinflection.reasons, @@ -96,7 +91,16 @@ class Translator { } } - return Promise.all(promises).then(sets => this.processKanji(sets.reduce((a, b) => a.concat(b), []))); + return Promise.all(promises).then(defSets => { + const definitions = defSets.reduce((a, b) => a.concat(b), []); + for (const definition of definitions) { + const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta)); + tags.push(buildDictTag(definition.dictionary)); + definition.tags = sortTags(tags); + } + + return definitions; + }); } findTermDeinflections(text, dictionaries, cache) { |