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

Download - Tipitaka Pali for PC

A new software for reading and studying the Tipiṭaka Pāḷi (available both offline and online), featuring useful features like Pāḷi, Sanskrit, Tipiṭaka Pāḷi-Myanmar (တိပိဋက ပါဠိ-မြန်မာအဘိဓာန်) dictionaries and full-text search... ---- Download Offline Tipitaka Pali : Tipitakapali.org offline software is FREELY available for all major platforms : Windows, macOS, Linux, Android, and iOS. Access the online version : https://tipitakapali.org The Pāḷi text is based on the Chaṭṭha Saṅgāyana Tipiṭaka Pāḷi edition (VRI) , with corrections for Pāḷi typos up to August 2024. Happy reading!

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.