From the other thread, it chooses the language using the most specific settings. So, in order it is:
- <tag lang="some_language">
- <html lang="some_language">
- opf <dc:language>some_language</dc:language>
- editor-preferred-language "some_language"
I tested it with a book in English that had some dialog in Spanish (a character tended to swear in Spanish) and Hebrew (different character, same reason). When I wrapped spans around the dialog, or added a language attribute to a paragraph, the spelling errors went away. Neat, but a lot of work.
I also tried the opf and file level setting. I used "en-US" in the OPF and "en-GB" in the file and "colour" was correctly spelt and "color" incorrect.
Something I had forgotten to try last week was if the file was less specific than the OPF. So, I have just tried "en-GB" and "en" in the file. With this combination, whatever is the editor specified default is used. So choosing US in the editor showed "colour" as incorrect and "color" as correct.
For the attributes on the html tag, the epub I used started with both. Either seem to work but the non-xml one seemed to have precedence.
One other thing I just noticed, if I change the language in the OPF, I have to save and reopen the file for it to take affect. Changing any of the others has an affect in the current session.