Update merged definitions to have consistent structure (#890)
* Update comment about definitions type * Add conversion to ensure consistent data structure
This commit is contained in:
parent
7ce87c51b4
commit
69f94f8cb8
@ -199,7 +199,7 @@ class Translator {
|
|||||||
const compatibilityDefinition = this._createMergedTermDefinition(
|
const compatibilityDefinition = this._createMergedTermDefinition(
|
||||||
source,
|
source,
|
||||||
rawSource,
|
rawSource,
|
||||||
definitions2,
|
this._convertTermDefinitionsToMergedGlossaryTermDefinitions(definitions2),
|
||||||
[expression],
|
[expression],
|
||||||
[reading],
|
[reading],
|
||||||
termDetailsList,
|
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
|
// Metadata building
|
||||||
|
|
||||||
async _buildTermMeta(definitions, enabledDictionaryMap) {
|
async _buildTermMeta(definitions, enabledDictionaryMap) {
|
||||||
|
Loading…
Reference in New Issue
Block a user