xxyzz / WordDumb

A calibre plugin that generates Kindle Word Wise and X-Ray files for KFX, AZW3, MOBI and EPUB eBook.
https://xxyzz.github.io/WordDumb/
GNU General Public License v3.0
386 stars 19 forks source link

KeyError: 'zh_cn' after "Customize Kindle Word Wise" #116

Closed lotrecia closed 1 year ago

lotrecia commented 1 year ago

Checkboxes

Describe the bug

KeyError: 'zh_cn' after "Customize Kindle Word Wise"

System Information

MacOS 13.4 Calibre 6.15 Plugin 3.29.1 python: 3.11

Error message

calibre, version 6.15.0
ERROR: Unhandled exception: <b>KeyError</b>:'zh_cn'

calibre 6.15  embedded-python: True
macOS-13.4-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '22.5.0', 'Darwin Kernel Version 22.5.0: Fri Mar 17 14:38:40 PDT 2023; root:xnu-8796.120.16~15/RELEASE_ARM64_T8103')
Python 3.10.1
OSX: ('13.4', ('', '', ''), 'arm64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && Annotations (1, 17, 13) && Category Tags (0, 2, 7) && Count Pages (1, 13, 0) && Douban Books (3, 2, 0) && Generate Cover (2, 3, 2) && Goodreads (1, 7, 6) && Goodreads_Rating (4, 0, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Set KFX metadata (from KFX Output) (1, 66, 0) && KFX Output (1, 66, 0) && Kindle hi-res covers (0, 5, 0) && KindleUnpack - The Plugin (0, 83, 1) && Prettify Cover (1, 6, 0) && Reading List (1, 15, 1) && Resize Cover (1, 2, 0) && Wikidata gui (2, 0, 0) && WordDumb (3, 29, 1)
Traceback (most recent call last):
  File "calibre_plugins.worddumb.config", line 231, in open_choose_lemma_lang_dialog
    choose_lang_dlg = ChooseLemmaLangDialog(self, is_kindle)
  File "calibre_plugins.worddumb.config", line 476, in __init__
    self.lemma_lang_changed()
  File "calibre_plugins.worddumb.config", line 523, in lemma_lang_changed
    _(language_dict[self.prefer_gloss_code]["name"])
KeyError: 'zh_cn'

Reproduce steps

  1. Customize Kindle Word Wise
  2. choose Chinese simplified as gloss language, confirm
  3. Customize Kindle Word Wise
  4. get the error: KeyError: 'zh_cn'

Screenshots or videos

CleanShot 2023-04-07 at 19 06 09@2x
xxyzz commented 1 year ago

https://github.com/xxyzz/WordDumb/commit/9afb0e78097d4aa564857af12034eb43056d0f70 should fix this error. You can download the test plugin from here: https://github.com/xxyzz/WordDumb/actions/runs/4647680770

lotrecia commented 1 year ago

Thanks!!