Requirements
Install pyglossary
pip3 install pyglossary
Install Kindle Previewer
Download Kindle Previewer(At the time of writing, Kindle Previewer version 3.88.0 (Windows).)
Step 1: Convert Dictionary Data to .mobi Format with Pyglossary
Pyglossary will generate a folder (e.g., mydict.mobi
) instead of a .mobi file.
Within this folder, navigate to the OEBPS
directory, where you'll find the content.opf
file.
Step 2: Preview the content.opf
File in Kindle Previewer
Open Kindle Previewer and go to File > Open Book (or press Ctrl + O).
Select the
content.opf
file you found in Step 1.Note: The preview may take some time to process, depending on the size of your dictionary.
Tip: To speed up the preview, you can duplicate the
content.opf
file (e.g.,content_min.opf
) and remove most.xhtml
files from themanifest
andspine
sections, leaving only one:<manifest> <item href="style.css" id="style.css" media-type="text/css" /> <item href="g000002.xhtml" id="g000002.xhtml" media-type="application/xhtml+xml" /> </manifest> <spine> <itemref idref="g000002.xhtml" /> </spine>
If you encounter errors during preview, check the Conversion Log in Kindle Previewer.
For example, you may see:"Error","E23005: Language not specified in metadata. The dc:Language field is mandatory. Aborting."
This means the
content.opf
file is missing thedc:Language
field value, along with other possible missing fields such asDictionaryInLanguage
andDictionaryOutLanguage
.To resolve this, manually add the missing fields in the
content.opf
file.
Step 3: Export the .mobi File from Kindle Previewer
Once the preview is complete, go to File > Export in Kindle Previewer.
If it allows you to export as a .mobi file, great! You’re done.
If the export option is unavailable (e.g., due to large file size), proceed to Step 4.
Step 4: (Optional) Use kindlegen.exe
If Kindle Previewer doesn’t allow you to export, you can use the kindlegen.exe
tool, which is included with Kindle Previewer.
Navigate to the
kindlegen.exe
location:C:\Users\<your_username>\AppData\Local\Amazon\Kindle Previewer 3\lib\fc\bin\
Open a Windows Terminal or PowerShell window, and run the following command:
C:\Users\<your_username>\AppData\Local\Amazon\Kindle Previewer 3\lib\fc\bin\kindlegen.exe .\mydict.mobi\OEBPS\content.opf -o mydict.mobi
(Replace
<your_username>
with your actual Windows username.)
This should generate the .mobi
file for your dictionary.
Comments
Post a Comment