mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix importing a list of words into a user dictionary not working. Fixes #2064887 [Import of words into dictionary fails](https://bugs.launchpad.net/calibre/+bug/2064887)
This commit is contained in:
parent
6d9d698ab2
commit
bf4b7357dd
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user