aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-06 19:31:53 -0400
committerGitHub <noreply@github.com>2020-10-06 19:31:53 -0400
commit69f94f8cb8225cc20f2c860524b142642d385412 (patch)
treeaeeefda393c01ff9827f3d5347b2a5a07577d972 /ext/bg
parent7ce87c51b4fcb5d0507b4668b210ffe2531fea22 (diff)
Update merged definitions to have consistent structure (#890)
* Update comment about definitions type * Add conversion to ensure consistent data structure
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/translator.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index e11d0269..3767b47e 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -199,7 +199,7 @@ class Translator {
const compatibilityDefinition = this._createMergedTermDefinition(
source,
rawSource,
- definitions2,
+ this._convertTermDefinitionsToMergedGlossaryTermDefinitions(definitions2),
[expression],
[reading],
termDetailsList,
@@ -647,6 +647,18 @@ class Translator {
}
}
+ _convertTermDefinitionsToMergedGlossaryTermDefinitions(definitions) {
+ const convertedDefinitions = [];
+ for (const definition of definitions) {
+ const {source, rawSource, expression, reading} = definition;
+ const expressions = new Set([expression]);
+ const readings = new Set([reading]);
+ const convertedDefinition = this._createMergedGlossaryTermDefinition(source, rawSource, [definition], expressions, readings, expressions, readings);
+ convertedDefinitions.push(convertedDefinition);
+ }
+ return convertedDefinitions;
+ }
+
// Metadata building
async _buildTermMeta(definitions, enabledDictionaryMap) {