Skip to main content

How to Generate a .mobi Dictionary File for Kindle using Pyglossary and Kindle Previewer

Requirements

  1. Install pyglossary 

    pip3 install pyglossary
  2. 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

  1. Open Kindle Previewer and go to File > Open Book (or press Ctrl + O).

  2. 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 the manifest and spine 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>
    
  3. 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 the dc:Language field value, along with other possible missing fields such as DictionaryInLanguage and DictionaryOutLanguage.

    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.

  1. Navigate to the kindlegen.exe location:
    C:\Users\<your_username>\AppData\Local\Amazon\Kindle Previewer 3\lib\fc\bin\

  2. 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

Popular Posts

Testing Pali-English translation on Claude Sonnet (Free plan)

Claude 3 Sonnet (free):  Claude B You are a professional Pali English translator Very well, I will act as a professional Pali-English translator. Pali is the canonical language of Theravada Buddhism, used to preserve the Buddha's teachings in texts like the Tipitaka. Please provide me with the Pali text you need translated and I will do my best to render an accurate English translation while preserving the nuances and spirit of the original.

How to Maintain Playlist Order on Mini Audio Players

Quick Guide: Maintain Playlist Order on Mini Audio Players 1. Issues The player may not follow the order of your audio file names all the time, but it will follow the order in which your audio files are written to the SD Card. 2. Solution Remember, the key is the order in which files are written to the microSD card or USB. To maintain the playlist order on mini audio players, follow these simple steps: 1. Format your microSD card using FAT32. 2. (This step is optional) Create a folder named "AAAA" on the microSD card.  3. Backup your original audio files and use a bulk rename tool to prepend a 4-digit number (starting with 1111) to the file names. 4. Sort the renamed files by name in ascending order. 5. For Windows OS, Click the first file to select it , <= this step is important , then press Ctrl + A , Ctrl + C , and Ctrl + V to copy and paste the files into the "AAAA" folder on the microSD card. Tip : on Linux OS,  you may try using a twin panel file managemen...

The Next Generation Goldendict - An Open Source Multi-Dictionary Look Up Program

The Next Generation GoldenDict - A feature-rich open-source dictionary lookup program, supporting multiple dictionary formats and online dictionaries. Read more on its source code repository:  https://github.com/xiaoyifang/goldendict-ng Installation https://xiaoyifang.github.io/goldendict-ng/install/ Download latest releases https://github.com/xiaoyifang/goldendict-ng/releases Digital Pali Dictionary (dictionary data) https://github.com/digitalpalidictionary/digitalpalidictionary/releases