Thursday, October 10, 2013

Convert Babylon BLG to Stardict IFO dictionaries


ColorDict Dictionary Wikipedia - screenshot thumbnail



If you use the excellent ColorDict for Android, which is capable of modal windows (unlike, say GoldenDict, which in turn can read many dictionary formats), then you may be in need for more dictionaries than Google allows.

Here's how to quickly convert Babylon BLG dictionary files to the Stardict, aka IFO, aka ColorDict format in Windows.
  • Download a BLG dictionary file itself, from the Babylon site, or e.g. from a torrent here. (We will use Spanish-English Dictionary (Granada University, Spain), 13.5 dictionary file below, saved to C:\Temp\Babylon stardict files\)
  • Download and install Python 2.* to C:\Program Files\Python27\ (Important: Python 3.* is not compatible with the script, as of yet)
  • Download PyGlossary 2011 from the PyGlossary site to e.g. C:\Temp\Babylon stardict files\pyglossary-2011.06.16\. (Important: the older versions seem not do not produce Stardict compatible files)
  • Here's the trick. Do not run its otherwise nice GUI. Run a DOS command instead:
    "C:\Program Files\Python27\python.exe" "C:\Temp\Babylon stardict files\pyglossary-2011.06.16\src\pyglossary.pyw" "C:\Temp\Babylon stardict files\A Spanish-English Dictionary (Granada University, Spain).BGL" "C:\Temp\Babylon stardict files\A Spanish-English Dictionary (Granada University, Spain).ifo"
  •  You should see:
    Reading file "C:\Temp\Babylon stardict files\A Spanish-English Dictionary (Granada University, Spain).BGL"
    numEntries = 80289
    defaultCharset = cp1252
    sourceCharset = cp1252
    targetCharset = cp1252
    defaultEncoding = cp1252
    sourceEncoding = cp1252
    targetEncoding = cp1252
    sourceLang = Spanish
    targetLang = English
    creationTime = 2006/12/12, 09:22
    middleUpdated = 2010/02/23, 07:54
    lastUpdated = 2010/02/23, 07:54
    title = A Spanish-English Dictionary (Granada University, Spain), 10.2
    author = Tony
    email = alozano@ugr.es
    copyright =
    description = This is a compilation of terminology in the social sciences that students and professionals generally encounter when reading professional literature with a particular emphasis on information organisation and retrieval. Last update February 2010. (http://eubd1.ugr.es)
    Loading: |Ôľł                                               /  2.5% ETA: 00:00:3
    Loading: |ÔľłÔľł                                              -  5.0% ETA: 00:02
    Loading: |ÔľłÔľłÔľł                                             \  7.5% ETA: 00:
    Loading: |ÔľłÔľłÔľłÔľł                                            | 10.0% ETA: 0
    Loading: |ÔľłÔľłÔľłÔľłÔľł                                           / 12.5% ETA:
    Loading: |ÔľłÔľłÔľłÔľłÔľłÔľłÔľł                                         - 14.9%
     etc.

    • Be patient! The script seems to get stuck on:
    Writing to file "c:\temp\A Spanish-English Dictionary (Granada University, Spain).ifo"
    filename=c:\temp\A Spanish-English Dictionary (Granada University, Spain).ifo
    but after about a dozen of minutes it terminates with:
    Done
    and returns to the command prompt.
    You should get:
    Copy these to the \sdcard\dictdata directory on your Android and run ColorDict.