bookfere / Ebook-Translator-Calibre-Plugin

A Calibre plugin to translate ebook into a specified language.
https://translator.bookfere.com
GNU General Public License v3.0
1.54k stars 102 forks source link

[错误报告] 翻译完毕后,输出文件时报错 #326

Closed yuan1129 closed 2 weeks ago

yuan1129 commented 2 weeks ago

Win11、Calibre版本:7.12.0、插件版本:V 2.3.4

翻译完毕后,输出文件时报错

══════════════════════════════════════ 耗时:0.09 分钟 翻译已完成。 Traceback (most recent call last): File "runpy.py", line 198, in _run_module_as_main File "runpy.py", line 88, in _run_code File "site.py", line 83, in File "site.py", line 78, in main File "site.py", line 50, in run_entry_point File "calibre\utils\ipc\worker.py", line 215, in main File "calibre\utils\ipc\worker.py", line 150, in arbitrary_n File "calibre_plugins.ebook_translator.lib.conversion", line 242, in convert_item File "calibre_plugins.ebook_translator.lib.conversion", line 86, in convert_book File "calibre\ebooks\conversion\plumber.py", line 1305, in run File "calibre_plugins.ebook_translator.lib.conversion", line 74, in convert File "calibre_plugins.ebook_translator.lib.element", line 682, in add_translations File "calibre_plugins.ebook_translator.lib.element", line 285, in add_translation File "calibre_plugins.ebook_translator.lib.element", line 247, in _create_new_element File "src/lxml/etree.pyx", line 3266, in lxml.etree.XML File "src/lxml/parser.pxi", line 1989, in lxml.etree._parseMemoryDocument File "src/lxml/parser.pxi", line 1869, in lxml.etree._parseDoc File "src/lxml/parser.pxi", line 1105, in lxml.etree._BaseParser._parseUnicodeDoc File "src/lxml/parser.pxi", line 633, in lxml.etree._ParserContext._handleParseResultDoc File "src/lxml/parser.pxi", line 743, in lxml.etree._handleParseResult File "src/lxml/parser.pxi", line 672, in lxml.etree._raiseParseError File "", line 1 lxml.etree.XMLSyntaxError: Namespace prefix epub for type on a is not defined, line 1, column 190

Calibre

bookfere commented 2 weeks ago

谢谢反馈。请提供一份样本以便测试。

yuan1129 commented 2 weeks ago

发您邮件bookfere@gmail.com

bookfere commented 2 weeks ago

这是一个已修复的错误 f892863a8b58acbd9e63b199496a44a87401314d。不过修复后的版本还未发布,请手动下载安装 Rolling Release 版本试用:https://translator.bookfere.com

yuan1129 commented 2 weeks ago

下载了Rolling Release,可以输出文件了,但是输出的文件里的格式好像不对了。 Calibre

bookfere commented 2 weeks ago

这种技术类的书籍排版比较复杂,想要得到较好的效果,还有很多工作要做。

bookfere commented 2 weeks ago

对于代码结构有规律的元素,比如有同样的 class 属性,也可以使用设置中的“保留元素”功能添加 CSS 选择器来保留元素,这样可以避免翻译指定元素中的内容。不过需要注意,添加完 CSS 选择器后需要删除旧缓存让插件重新提取内容。

比如这本书中的代码都在 class 属性为 programcode 的元素里,就可以把这个 CSS 选择器加到设置中的“保留元素”中。

screenshot_0 screenshot_1 screenshot_2
yuan1129 commented 2 weeks ago

感谢 :)