How to Fix Dictionary Problems in iBooks 1.1 | iLounge Backstage

Backstage

How to Fix Dictionary Problems in iBooks 1.1

Author's pic

By Jesse Hollington

Social Media & Software Editor, iLounge
Published: Tuesday, June 22, 2010
Backstage Categories:

As an avid e-book reader I have amassed quite a collection of e-books over the past few years. When the iPad first debuted with its open support for the ePub format I began enthusiastically converting much of my existing catalog of e-books into the ePub format using Calibre so that I would be able to read them on my iPad. The appearance of iBooks 1.1 on the App Store yesterday with its support for iPhone and iPod touch devices promised to improve this reading experience further by allowing me to read my e-books on my other iOS devices and seamlessly sync reading positions between them, providing a very Kindle-like experience but with the nicer UI and more advanced features of the iBooks application.

Unfortunately, after updating to iBooks 1.1 I discovered that I could no longer use the dictionary for any of my own converted titles. Tapping on a word and asking for a dictionary lookup, which worked fine in the prior version of iBooks, now resulted in a pop-up window with the message: “Dictionary not available for this language.”

The few e-books that I had downloaded from the free Project Gutenberg collection on the iBookstore did not have this problem, only the e-books that I had converted myself. A bit of investigation on the Mobileread forums revealed that in some cases Calibre does not store a correct language identifier when converting files to an ePub format, nor does it provide any easy way to actually specify a language identifier yourself. In fact, it appears that Calibre writes the language into the ePub output files as “UND,” presumably for “Undefined.” Of course, since iBooks 1.1 has no dictionary available for a language code of “UND” it simply says so. Likewise, iTunes has no way of setting the language for an ePub title. It appears that iBooks 1.0.x either didn’t care about the language specified in the e-book or at least “fell back” to a default dictionary if it didn’t have one available for a given language.

The solution to the problem is actually somewhat simple if you’re willing to dig under the hood a bit. ePub files are actually just ZIP files containing the various components that make up the text and other metadata for the file, which means that you can grab any of your ePub titles and take them apart yourself. Inside the ePub zip file is an XML file named content.opf which contains the metadata for that particular title, including the language definition. You can extract this file using any common zip utility and edit it with a text or XML editor. You basically just need to change the information between the dc:language tags from “UND” to something like “en” for English, then save the file and put it back into the ePub archive.

If you’re using a Mac, you can easily accomplish this from the Terminal command line by using the built-in unzip command to extract just the content.opf file, edit it using TextEdit using open -e and then put it back using the zip command, as shown below.

You can get the actual path to your ePub file from within iTunes by right-clicking and choosing the Show in Finder option from the context menu. This will open a Finder window to the folder containing the e-book. From the Finder window, you can simply drag-and-drop the ePub file directly into the Terminal window to paste in the path to the file at the current cursor position:

Once you’ve edited the content.opf file and put it back into the ePub package, simply re-copy the e-book back onto your devices. Note that iTunes will not automatically update the file for you—you’ll need to remove the e-book from your iPad or iPhone first by DE-selecting it for synchronization and then put it back on. Once the file has been properly recopied to your device, iBooks 1.1 should recognize the new language as being supported and use the correct dictionary.

« Early iPhone 4 Phone Audio Quality Testing Results

On ePub, or Why Our Buyers’ Guides Aren’t Coming To iBooks »

Related Stories

Comments

1

A much easier way, especially if you have multiple files:

for file in *.epub ; do unzip “$file” content.opf && mv content.opf content.opf.bak && sed ‘s/\<dc\:language\>UND\<\/dc\:language\>/\<dc\:language xsi\:type\=\“dcterms\:RFC4646\”\>en\<\/dc\:language\>/’ < content.opf.bak > content.opf && zip “$file” content.opf && rm -f content.* ; done

That only works on Mac OS X and Linux. Sorry, Windows guys, you knew the risks choosing the platform that doesn’t have decent scripting tools wink

Mac users - you need to delete the old books from iTunes, sync your iPads to have them gone from there too, then add the newly converted ones back to iTunes and then re-sync iPad again.

Posted by Dmitry on June 22, 2010 at 11:38 AM (PDT)

2

Dmitry, I get the following error for each file in the folder with the script:

unzip:  cannot find or open “??, “??.zip or “??.ZIP.


Any ideas? I am in the correct folder in terminal.

Posted by JS on June 22, 2010 at 2:45 PM (PDT)

3

Dmitry’s script works, but you have to change the single and double quotation marks in text edit (in plain text) before pasting it into the terminal window

Posted by JS on June 22, 2010 at 3:19 PM (PDT)

4

Hi. Thanks for the tip. An other question : Is there any way to install and use a build-in French/Spanish/Italian or German dictionary into iBooks with non-English books ?

Thanks in advance.

Posted by Alex on June 24, 2010 at 2:55 PM (PDT)

5

If you are building the epub with Calibre, make sure you are using the ver 0.7.8 or later.  In Calibre, link to iTunes through the ‘send to device’ menu and then send the epubs to iTunes using Calibre.  This will create epubs in iTunes that WORK. 

Caution! Using Calibre ‘save to file’ of those exact same epubs will produce files containing the originally described dictionary error.  You can find the working file in your iTunes library ‘books’ folder.

Hope this helps!

Posted by ZaMama on July 9, 2010 at 3:44 PM (PDT)

6

hi,
thanx for the post.
i m using win7
i opened the content.opf in text editor. The dc:language is already set to ‘en’. Still i m not able to use the dictionary function. Plz help me with this.

Posted by Swapnil on July 10, 2010 at 11:39 AM (PDT)

7

Thanks ZaMama! That worked perfectly.

Posted by Eric on July 12, 2010 at 11:24 AM (PDT)

8

@Swapnil

Try entering it with capital letters i.e: EN
Worked for me

Posted by paboleo on August 14, 2010 at 7:53 AM (PDT)

9

please help! can i get spanish definitions with the built in dictinary? what are the initials that i have to use?  thanks

Posted by javier on September 10, 2010 at 9:47 AM (PDT)

10

The dictionary languages are predefined. Apple may add Spanish, but you cannot.

But, if you set your language to English, your definitions may still work, because they have search Wikipedia and google buttons at the bottom. smile

Posted by V. on September 12, 2012 at 10:37 AM (PDT)

If you have a comment, news tip, advertising inquiry, or coverage request, a question about iPods or accessories, or if you sell or market products, read iLounge's Comments + Questions policies before posting, and fully identify yourself if you do. We will delete comments containing advertising, astroturfing, trolling, personal attacks, offensive language, or other objectionable content, then ban and/or publicly identify violators. Wondering why we're talking about something other than iPods? Check the Archives: Backstage has been here and kicking it since 2004.

Commenting is not available in this section entry.
Sign up for the iLounge Weekly Newsletter

Email:

Recent News

Recent Reviews

Recent Articles

Sign up for the iLounge Weekly Newsletter

Email:

iLounge is an independent resource for all things iPod, iPhone, iPad, and beyond.
iPod, iPhone, iPad, iTunes, Apple TV, Mac, and the Apple logo are trademarks of Apple Inc.
iLounge is © 2001 - 2014 iLounge, Inc. All Rights Reserved. Terms of Use | Privacy Policy