Quote:
Originally Posted by kovidgoyal
xml:lang (or actually just lang in modern html) sets the language for the contents of the tag it appears on, *and that is all*. Not the whole book, or even not the whole html file (assuming the tag is not the root <html> tag). And spellcheck respects that, as it is supposed to. That has *nothing* to do with what the overall language for the book is.
|
I think there has been a little confusion in the discussion. I don't think that anyone was denying that the book language was set in the OPF but that it could be overridden in other places. I think the real question was why the language set for the titlepage.xhtml was always English. And, I understand you reasoning. But...
That doesn't take into account TTS applications. Which includes the calibre viewer. Testing it, that page is completely skipped as there is no text to be read out. For most of my books that is sort of OK as it is the cover and there is a text title page after it. That gets read out. But, I also have enough books that don't have this, and some that have an image as the second page with the title and author.
I add a heading the to titlepage.xhtml so that it will be added to the ToC if I rebuild it. It will either just be "Cover" or the actual title if the second page doesn't have it. But, I add it with "display:none" so it doesn't appear and is not read out.
I think it would be good to have something on this page for TTS. And if that was done, setting the language correctly should be done.
I had a quick look at what needed to be done when using the svg style covers. It looks like adding an <desc> tag will be read out. So:
Code:
<div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 781 1250" preserveAspectRatio="xMidYMid meet">
<desc>Description of Book Cover Page</desc>
<image width="781" height="1250" xlink:href="../cover.jpeg"/>
</svg>
</div>
There was mention of using the <title> tag and an attribute "aria-labelledby" and ids on the other tags to connect them together. But, the above is what worked.
I assume the alt attribute on img tags are read. I haven't played with that as I like the way svg covers work.