How to convert stardict dictionary file format to any readable format?

How to convert stardict dictionary file format to any readable format (xml, txt or something)?


Solution 1:

The stardict-tools tarball downloadable from their website has a stardict2txt tool that you'll need to build from source.

Solution 2:

I found this step by step guide on how to use the StarDict editor for Windows in order to decompile a StarDict dictionary to XML format.

  • Extract all files to a folder and then launch the file stardict-editor.exe, switch to the tab DeCompile.
  • Now look at the dictionary files of StarDict you got, there should be 3 files : *.idx, *.ifo, *.dz.
  • Rename the *.dz file to *.gz. Use WinZip or WinRAR to extract the *.dict file inside.
  • Rename all the *.dict, *.ifo, *.idx files to a same name.
  • Back to the StarDict Editor program, click Browse and select the *.ifo file and hit Decompile.
  • You will see a new *.txt file inside the folder.
  • Use it with DfM DictionaryGeneration.

Solution 3:

Your can use this:

https://github.com/ilius/pyglossary

If your need install it for user on linux your can create virtualenv and acrivate it

  git clone https://github.com/ilius/pyglossary.git
  cd pyglossary
  #1. Add to setup.py after:
  #import logging
  #next line:
  #logging.basicConfig()
  #
  #1. change in setup.py 
  #from pyglossary.glossary import VERSION to
  #VERSION = "3.1.0" # version that was tested in my case
  python setup.py
  pyglossary

And converter will be running, that your can doing different conversions.

Other way:

There is file .dict.dz.

  1. Emacs open it as text file, then you can copy text and place it to some file.
  2. execute:

    dictunzip <dictname>.dict.dz

To convert it to .dict file, and read as text file. Program dictunzip is in package dictzip (debian, ubuntu). In my case .dict was readable, may be in some cases it is binary.