![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
|
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 |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,249
Karma: 27110894
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.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
|
@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 |
![]() |
![]() |
![]() |
#4 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (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. |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,249
Karma: 27110894
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.
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
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. |
![]() |
![]() |
![]() |
#8 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
So the precedence seems to be:
Presumably <span lang="some_language"> is first? And if editor-preferred-language overrides the opf, it *should* override html lang as well? |
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,249
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#10 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Thanks, that fixes it.
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |