diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index 2b7cd96a4b..0b870f0871 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -493,8 +493,8 @@ class ManageUserDictionaries(Dialog): 'You must specify a language to import words'), show=True) words = set(filter(None, [x.strip() for x in str(w.toPlainText()).splitlines()])) lang = lc[0] - words = {(w, lang) for w in words} - self.current_dictionary.words - if dictionaries.add_to_user_dictionary(self.current_dictionary.name, words, DictionaryLocale(lang, None)): + words_with_lang = {(w, lang) for w in words} - self.current_dictionary.words + if dictionaries.add_to_user_dictionary(self.current_dictionary.name, words_with_lang, DictionaryLocale(lang, None)): dictionaries.clear_caches() self.show_current_dictionary() self.dictionaries_changed = True diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index 7e1ecad0c4..8d6f2a26df 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -291,7 +291,7 @@ class Dictionaries: wl = len(ud.words) if isinstance(word, (set, frozenset)): ud.words |= word - self.add_user_words(word, locale.langcode) + self.add_user_words({x[0] for x in word}, locale.langcode) else: ud.words.add((word, locale.langcode)) self.add_user_words((word,), locale.langcode)