mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Fix error when trying to add words to user dictionary for a book with a language that has no dictionary available. Fixes #1517928 [problem with spellchecker](https://bugs.launchpad.net/calibre/+bug/1517928) [problem with spellchecker](https://bugs.launchpad.net/calibre/+bug/1517928)
This commit is contained in:
parent
45e732332d
commit
e150b9f159
@ -243,13 +243,13 @@ class Dictionaries(object):
|
|||||||
|
|
||||||
def add_user_words(self, words, langcode):
|
def add_user_words(self, words, langcode):
|
||||||
for d in self.dictionaries.itervalues():
|
for d in self.dictionaries.itervalues():
|
||||||
if getattr(d.primary_locale, 'langcode', None) == langcode:
|
if d and getattr(d.primary_locale, 'langcode', None) == langcode:
|
||||||
for word in words:
|
for word in words:
|
||||||
d.obj.add(word)
|
d.obj.add(word)
|
||||||
|
|
||||||
def remove_user_words(self, words, langcode):
|
def remove_user_words(self, words, langcode):
|
||||||
for d in self.dictionaries.itervalues():
|
for d in self.dictionaries.itervalues():
|
||||||
if d.primary_locale.langcode == langcode:
|
if d and d.primary_locale.langcode == langcode:
|
||||||
for word in words:
|
for word in words:
|
||||||
d.obj.remove(word)
|
d.obj.remove(word)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user