From 6e0a367afcae07ae6f8274c7310950af613b4bf0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 26 Jun 2021 11:57:09 -0400 Subject: Translator data format updates (#1754) * Add {dictionaryIndex, dictionaryPriority} to definitions * Add score to definitions * Add id to definition * Use definition id instead of ids array * Remove ids array * Update docs * Update test data --- ext/js/data/anki-note-data-creator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/js/data') diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index c76369c3..6a6bfd36 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -274,7 +274,7 @@ class AnkiNoteDataCreator { case 'merge': type = 'termMerged'; break; } - const {ids, inflections, score, dictionaryIndex, dictionaryPriority, sourceTermExactMatchCount} = dictionaryEntry; + const {inflections, score, dictionaryIndex, dictionaryPriority, sourceTermExactMatchCount, definitions} = dictionaryEntry; const { screenshotFileName=null, @@ -301,7 +301,7 @@ class AnkiNoteDataCreator { return { type, - id: (type === 'term' ? ids[0] : void 0), + id: (type === 'term' && definitions.length > 0 ? definitions[0].id : void 0), source: (primarySource !== null ? primarySource.transformedText : null), rawSource: (primarySource !== null ? primarySource.originalText : null), sourceTerm: (type !== 'termMerged' ? (primarySource !== null ? primarySource.deinflectedText : null) : void 0), -- cgit v1.2.3