aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
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);