aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/js/language/translator.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index 04c78258..3ee9c3b7 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -371,7 +371,7 @@ class Translator {
if (sequenceList.length > 0) {
const secondarySearchDictionaryMap = this._getSecondarySearchDictionaryMap(enabledDictionaryMap);
- await this._addRelatedDictionaryEntries(groupedDictionaryEntries, ungroupedDictionaryEntriesMap, sequenceList, mainDictionary, enabledDictionaryMap);
+ await this._addRelatedDictionaryEntries(groupedDictionaryEntries, ungroupedDictionaryEntriesMap, sequenceList, enabledDictionaryMap);
for (const group of groupedDictionaryEntries) {
this._sortTermDictionaryEntriesById(group.dictionaryEntries);
}
@@ -388,7 +388,7 @@ class Translator {
return newDictionaryEntries;
}
- async _addRelatedDictionaryEntries(groupedDictionaryEntries, ungroupedDictionaryEntriesMap, sequenceList, mainDictionary, enabledDictionaryMap) {
+ async _addRelatedDictionaryEntries(groupedDictionaryEntries, ungroupedDictionaryEntriesMap, sequenceList, enabledDictionaryMap) {
const databaseEntries = await this._database.findTermsBySequenceBulk(sequenceList);
for (const databaseEntry of databaseEntries) {
const {dictionaryEntries, ids} = groupedDictionaryEntries[databaseEntry.index];
@@ -474,20 +474,19 @@ class Translator {
for (const dictionaryEntry of dictionaryEntries) {
const {inflections, headwords: [{term, reading}]} = dictionaryEntry;
const key = this._createMapKey([term, reading, ...inflections]);
- let dictionaryEntries2 = groups.get(key);
- if (typeof dictionaryEntries2 === 'undefined') {
- dictionaryEntries2 = [];
- groups.set(key, dictionaryEntries2);
+ let groupDictionaryEntries = groups.get(key);
+ if (typeof groupDictionaryEntries === 'undefined') {
+ groupDictionaryEntries = [];
+ groups.set(key, groupDictionaryEntries);
}
- dictionaryEntries2.push(dictionaryEntry);
+ groupDictionaryEntries.push(dictionaryEntry);
}
- const results = [];
- for (const dictionaryEntries2 of groups.values()) {
- const dictionaryEntry = this._createGroupedDictionaryEntry(dictionaryEntries2, false);
- results.push(dictionaryEntry);
+ const newDictionaryEntries = [];
+ for (const groupDictionaryEntries of groups.values()) {
+ newDictionaryEntries.push(this._createGroupedDictionaryEntry(groupDictionaryEntries, false));
}
- return results;
+ return newDictionaryEntries;
}
// Tags