Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-21-2021, 05:49 AM   #1
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
How to change wrong xml:lang in multiple files?

I have books in English and German in my library. When I add a new book, I download the metadata, do an EPUB to EPUB conversion and then polish it. I don't know when this error occured, but suddenly all my German books have the wrong language tag embedded in the title page file.

When I open an EPUB in German with the editor, the titlepage shows this line:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">.

Is there a way to change this to xml:lang="de" in all affected EPUB files at once?
LucyOne is offline   Reply With Quote
Old 07-21-2021, 08:25 AM   #2
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
I've done some testing and it seems that Calibre adds xml:lang="en" during conversion, although the metadata show German as the correct language.

I've tried adding xml:lang="de" as a replacement text to the "search & replace" section in the conversion wizard, but it doesn't work. After conversion, the titlepage still shows xml:lang="en".
LucyOne is offline   Reply With Quote
Advert
Old 07-21-2021, 08:46 AM   #3
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The titlepage language is english, it doesnt contain any german text., all it contains is an image.
kovidgoyal is offline   Reply With Quote
Old 07-21-2021, 09:17 AM   #4
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
The problem is that xml:lang overrides the metadata language setting. So KOReader on my Pocketbooks recognizes those books as English, not as German, and sets hyphenation accordingly.

When I change it manually to xml:lang="de", the files are recognized as German in KOReader.
LucyOne is offline   Reply With Quote
Old 07-21-2021, 10:56 AM   #5
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That would be a bug in the pocketbook. lang attributes on individual html files must not override book language.
kovidgoyal is offline   Reply With Quote
Advert
Old 07-23-2021, 07:01 AM   #6
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
If the titlepage only contains an image, why should the language be defined for it? Wouldn't it be better to have xml:lang be the same language as the actual language of the book?

It would be great if that could be changed.
LucyOne is offline   Reply With Quote
Old 07-23-2021, 07:17 AM   #7
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Because the execrable epubcheck complains if there is no language.
kovidgoyal is offline   Reply With Quote
Old 07-23-2021, 10:16 AM   #8
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,016
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by LucyOne View Post
If the titlepage only contains an image, why should the language be defined for it?
Though an image, the language of the text could be not the same as all of the book.
Say an English version of "Das Boot".
Or a German version of "Three Men in a Boat".

It's a bit redundant but does make some sense.
Quoth is offline   Reply With Quote
Old 07-23-2021, 11:41 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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Not to mention that while the *calibre* titlepage is image only, in general titlepages may contain text.
kovidgoyal is offline   Reply With Quote
Old 07-27-2021, 03:20 AM   #10
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
Quote:
Originally Posted by Quoth View Post
Though an image, the language of the text could be not the same as all of the book.
Say an English version of "Das Boot".
Or a German version of "Three Men in a Boat".

It's a bit redundant but does make some sense.
Normally, if a book is translated, so is the cover image. Why should the cover image of a translated book be only in the original language? Even if the title is the same as in English (because it is understandable in the target language), there is usually an addendum in the second language. E.g. Douglas Coupland's "Generation A" in German is "Generation A: Ein Roman."

And if the titlepage contains any text, it is usually in the same language as the book, as well.
LucyOne is offline   Reply With Quote
Old 07-27-2021, 03:55 AM   #11
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
The developers of KOReader referred me to this source which says that xml:lang on an element has priority over what's specified on a parent element or in some kind of global metadata. So, it's not an error on their part.
https://html.spec.whatwg.org/multipa...html#attr-lang
LucyOne is offline   Reply With Quote
Old 07-27-2021, 04:16 AM   #12
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
What nonsense. The lang attribute in an individual html file inside an ebook DOES NOT override the overall language for the book. Your PocketBook developers dont seem to understand what an ebook is. The spec they quote is for a *single html document*, which is completely irrelevant for an ebook tht can be composed of multiple html documents each having their own potentially conflicting lang attributes.

The overall language of an ebook must be read from the metadata of the book. In the case fo EPUB books that means from the <metadata> section of the OPF file. Relevant spec: http://idpf.org/epub/30/spec/epub30-...-metadata-elem
kovidgoyal is offline   Reply With Quote
Old 07-27-2021, 09:15 AM   #13
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
The lang attribute in an individual html file inside an ebook DOES NOT override the overall language for the book.
Hmmm. This does not describe certain Calibre behavior then. All my books in Spanish are properly defined in the metadata--but if I change the lang attribute at the top of every html file from "es" to "en" then every Spanish word in the book gets noted by the Calibre spellcheck. (I use a very old version of Calibre, so maybe that behavior has changed...)

I never noticed that the Calibre titlepage is handled differently before this discussion. All my Spanish books have attr "en" there--but if I let Calibre make a jacket page, there is no lang attr at all.
Brett Merkey is offline   Reply With Quote
Old 07-27-2021, 10:49 AM   #14
LucyOne
Librocubicularist
LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.LucyOne ought to be getting tired of karma fortunes by now.
 
LucyOne's Avatar
 
Posts: 617
Karma: 11908623
Join Date: Dec 2013
Location: Germany
Device: PocketBook InkPad 3 & Touch HD 3, Kobo Clara HD, Kindle Paperwhite 5
@Brett: That happens to my books when I do a spellcheck, too. That's why I thought that xml:lang overrides other language tags. At least this behaviour should be fixed, then.
LucyOne is offline   Reply With Quote
Old 07-27-2021, 11:05 AM   #15
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: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
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.
kovidgoyal is offline   Reply With Quote
Reply

Tags
metadata language


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add xml:lang to ePub abraum ePub 14 07-12-2025 08:08 PM
xml:lang tage fredheim Conversion 5 04-25-2019 06:45 AM
xml:lang oddities jcsalomon ePub 1 06-06-2016 05:28 PM
xml:lang empty (pdf to epub) fxp33 Conversion 3 05-07-2015 11:40 PM
After merging all the .xml files, how do you divide it back into .xml files? automa Sigil 10 08-13-2013 07:43 AM


All times are GMT -4. The time now is 08:16 AM.


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