From 274b4173758003d2055265992e0c3506af68c89a Mon Sep 17 00:00:00 2001 From: Jessica Chen Date: Wed, 3 Jan 2024 20:54:26 +0000 Subject: [PATCH] Get reading from 'pronunciation' field in migaku dictionaries --- .../lib/src/dictionary/formats/migaku_dictionary_format.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yuuna/lib/src/dictionary/formats/migaku_dictionary_format.dart b/yuuna/lib/src/dictionary/formats/migaku_dictionary_format.dart index 03ac3da1..095be4e9 100644 --- a/yuuna/lib/src/dictionary/formats/migaku_dictionary_format.dart +++ b/yuuna/lib/src/dictionary/formats/migaku_dictionary_format.dart @@ -72,14 +72,15 @@ void prepareEntriesMigakuFormat({ String term = (map['term'] as String).trim(); String definition = map['definition'] as String; + String reading = map['pronunciation'] ?? ''; definition = definition .replaceAll('
', '\n') .replaceAll(RegExp('<[^<]+?>'), ''); - int headingId = DictionaryHeading.hash(term: term, reading: ''); + int headingId = DictionaryHeading.hash(term: term, reading: reading); DictionaryHeading heading = isar.dictionaryHeadings.getSync(headingId) ?? - DictionaryHeading(term: term); + DictionaryHeading(term: term, reading: reading); DictionaryEntry entry = DictionaryEntry( definitions: [definition],