summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-12 01:10:05 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-12 01:10:05 +0300
commit4e57fa1ad1cd85e18b2ae2c1d43480832533f9a7 (patch)
treefc4e9ed7f7c4e5a4dc9ab202a1b03b66620d8b7a /ext/bg/js/translator.js
parent7783aa4c1a36784b709aba768c17d9476a16a43d (diff)
merged mode: remove options.dictionary.main
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 737abd08..99344b95 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -50,10 +50,11 @@ class Translator {
async findTermsMerged(text, dictionaries, alphanumeric) {
const options = await apiOptionsGet();
+ const mainDictionary = Object.keys(options.dictionaries).filter(dict => options.dictionaries[dict].main).concat([''])[0];
const titles = Object.keys(dictionaries);
const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric);
- const definitionsBySequence = dictTermsMergeBySequence(definitions, options.dictionary.main);
+ const definitionsBySequence = dictTermsMergeBySequence(definitions, mainDictionary);
const definitionsMerged = [];
const mergedByTermIndices = new Set();
@@ -64,7 +65,7 @@ class Translator {
const result = definitionsBySequence[sequence];
- const rawDefinitionsBySequence = await this.database.findTermsBySequence(Number(sequence), options.dictionary.main);
+ const rawDefinitionsBySequence = await this.database.findTermsBySequence(Number(sequence), mainDictionary);
const definitionsByGloss = dictTermsMergeByGloss(result, rawDefinitionsBySequence);
dictTermsMergeByGloss(result, definitionsBySequence['-1'], definitionsByGloss, mergedByTermIndices);