Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 08-05-2014, 06:32 AM   #1
BobC
Addict
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 343
Karma: 245756
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, Various Android Apps
Controlling spelling language

At present I have a book where when I run a spelling check shows up all sorts of errors which are really US spellings rather than British (Color for colour etc).

The book was originally published in the US so they are not errors and shouldn't show as such.

Where do I set the language locale in the EPUB so that Calibre's spell checker uses "en-US" throughout. I don't want to set a language attribute for each paragraph and thought I could set the language in content.opf but that doesn't seem to work.

Do I need to do it for every html/xhtml file in the header ? if so could someone remind me of the syntax.

BobC
BobC is offline   Reply With Quote
Old 08-05-2014, 06:35 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,920
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The language from content.opf will work unless the html files define their own languages, in which case the latter will win. And you dont need to change the language, simply disable the en-gb dictionary, then the editor will fallback on the en-us dictionary for english.
kovidgoyal is online now   Reply With Quote
Old 08-05-2014, 11:01 AM   #3
BobC
Addict
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 343
Karma: 245756
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, Various Android Apps
@kovid,

I originally changed :
<dc:language>en</dc:language>
in content.opf to
<dc:language>en-US</dc:language>
but that didn't work. I perhaps misunderstood where I needed to change the language in content.opf.

Eventually I changed :
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
to
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

In the individual html files and that gave the desired result. I wanted to avoid disabling dictionaries if possible as I would probably forget to re-enable them later.

Thanks though for your rapid help.

BobC
BobC is offline   Reply With Quote
Old 08-05-2014, 02:00 PM   #4
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 5,858
Karma: 9077938
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
I think it is being overridden by the general term. I am guessing since your system is in "en_GB", "en" gets mapped to "en_GB". (I am no expert, but it sounds reasonable.)

If you specify it in the opf and remove the attribute from the html elements entirely, it should work.

Last edited by eschwartz; 08-05-2014 at 02:05 PM.
eschwartz is online now   Reply With Quote
Old 08-05-2014, 10:33 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 5,452
Karma: 5446662
Join Date: Jul 2011
Location: Australia
Device: Kobo Touch, Kobo Glo
I see the same problem as BobC. Some of the books I have use US spellings, some UK spelling and some are AU spelling. I don't normally worry about the last as UK will cover most of that.

From what I can see in this thread, I can set the version of English to use in the following places:

1. In the editor preferences, set the preferred English dictionary.
2. In the OPF using "<dc:language>en-GB</dc:language>"
3 In each file in the HTML tag.
4. Set the language at the tag level.

The last one I think is overkill, but is good idea for a few paragraphs of other languages.

Number 1. works if there is no language specified.

Number 3 works to override the other settings.

But, number 2. doesn't. If I set the editor preferred dictionary to en-US, and have the above line in the OPF, "colour" will be marked as a misspelling and "color" will not.

Number 2 also has a problem with how calibre maintains the metadata. The language list in the metadata editor only shows "English". When I open the editor, I have calibre syncing the metadata. This always sets the language in the OPF to just "en". That would mean I have to change it each time after opening the editor.

I'm probably missing something in how this works. At the moment, I am changing the editors preferred language depending on what I find in the book I am editing. Or if I otherwise know which dictionary should be used. It's a bit of a nuisance as I seem to be swapping between the language versions each time I open a book. If there is a better way to do it, I'd like to know. If this is the best method, then I'll probably look at a plugin to make toggling it easier. Or add the language attributes to each file.
davidfor is offline   Reply With Quote
Old 08-05-2014, 11:08 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,920
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
2. will only work if there is no lang specified in the html. That is the way epub works, lang in HTML overrides lang in OPF, nothing I can do about that.
kovidgoyal is online now   Reply With Quote
Old 08-05-2014, 11:48 PM   #7
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 5,452
Karma: 5446662
Join Date: Jul 2011
Location: Australia
Device: Kobo Touch, Kobo Glo
Well, unfortunately, it isn't working with 1.204 or 1.47.

The attached epub has the languages set to "en-GB" in the OPF. There are three chapters: one with no language set in the HTML tag and the others setting to "en-GB" and "en-NZ". The only text in each chapter is "color colour". When I set the preferred dictionary to en-US, the no-language chapter shows "color" as spelt correctly and "colour" as incorrect. The other two correctly show "color" as spelt incorrectly and "colour" as correct.

If the editor was using the language in the OPF to override the editor preferred language, I would expect all three files to show "color" as incorrect and "colour" as correct.

And as I mentioned, the metadata update will set the OPF language to just "en". For this test, I hadn't set a language in the metadata in the calibre library.
Attached Files
File Type: epub English Spelling Test - davidfor.epub (3.6 KB, 8 views)
davidfor is offline   Reply With Quote
Old 08-06-2014, 12:02 AM   #8
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 5,858
Karma: 9077938
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
So the precedence seems to be:
  1. <html lang="some_language">
  2. editor-preferred-language "some_language"
  3. opf <dc:language>some_language</dc:language>

Presumably <span lang="some_language"> is first?

And if editor-preferred-language overrides the opf, it *should* override html lang as well?
eschwartz is online now   Reply With Quote
Old 08-06-2014, 12:18 AM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,920
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...1e2aac0a810730
kovidgoyal is online now   Reply With Quote
Old 08-06-2014, 12:45 AM   #10
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 5,452
Karma: 5446662
Join Date: Jul 2011
Location: Australia
Device: Kobo Touch, Kobo Glo
Thanks, that fixes it.
davidfor is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
check spelling Divingduck Editor 99 05-13-2014 12:26 AM
Spelling anomalies DMB General Discussions 71 06-19-2012 07:55 AM
Spelling errors and such starrlamia General Discussions 29 11-29-2010 03:59 AM
Seriously thoughtful Spelling contractions SameOldStory Lounge 47 09-08-2010 09:08 PM
Spelling Macro PieOPah Workshop 36 12-13-2008 02:27 AM


All times are GMT -4. The time now is 12:40 AM.


MobileRead.com is a privately owned, operated and funded community.