Monday, 15 November 2010

iBooks "Dictionary not available for this language" fix

There is an irritating bug in the newest version of iBooks for iPhone (and probably also for iPad): if you try to use the built-in dictionary on English books that were converted (e.g. by Calibre) without the proper language set, you'll get an error:
Dictionary not available for this language
The culprit here is the metadata file of the ePub archive, content.opf. More specifically, it's an XML document that has a line corresponding to the language the book is supposed to be written in. The line should look like this:
<dc:language>en</dc:language>
But it often looks like this:
<dc:language>UND</dc:language>
I wrote a small script, epub-dict-fix, to batch-fix ePub files and assign a language (English by default) to them. You can get it from its Google Code homepage. I wrote it mainly for myself, but I hope it will be useful to someone else, too. Oh, and you need Python installed for it to work.

0 comments: