Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPUB2 can't satisfy package language requirement #376

Open
bswest opened this issue Jul 19, 2022 · 8 comments
Open

EPUB2 can't satisfy package language requirement #376

bswest opened this issue Jul 19, 2022 · 8 comments

Comments

@bswest
Copy link

bswest commented Jul 19, 2022

With 1.2.7, it looks like it's now impossible to create an EPUB2 file that can satisfy both ace and epubcheck.

1.2.7 raises an issue if language isn't declared in the package declaration (see #371).

But epubcheck doesn't allow this in EPUB2. If I try to include xml:lang in the package declaration of an EPUB2 file, epubcheck raises an error:

ERROR(RSC-005): File.epub/OEBPS/content.opf(1,102): Error while parsing file: attribute "xml:lang" not allowed here; expected attribute "id", "unique-identifier" or "version"

Should the language requirement only apply to EPUB3?

@danielweck
Copy link
Member

That's a good point, I'm not sure what the answer is. @rdeltour @mattgarrish do you know if EPUB2 package.opf supports xml:lang?

On a general note: Ace doesn't handle EPUB2 properly yet. From the top of my head: NCX parsing is missing IIRC ... but there may be other compatibility gaps (there is an issue in this GitHub tracker about this already).

@danielweck
Copy link
Member

EPUB2 incomplete support: #21

@bswest
Copy link
Author

bswest commented Jul 19, 2022

OK, that's good to know about EPUB2 gaps. While we've primarily used ace with EPUB3, we have historically run EPUB2 files through ace as well, just to ensure they're as good as they can be (within EPUB2 limitations). We'll keep in mind that EPUB2 files may be under-checked, but it would still be nice to check what we can. Thanks.

@mattgarrish
Copy link

You can't make a language declaration on the package element in EPUB 2, but you can declare it on all the metadata elements. That would be the ideal equivalent. Is Ace checking that a language is in scope for each metadata element, or only checking that it's declared on the package root?

@Changilainen
Copy link

I have recently encountered this same problem (w3c/epubcheck#1553) and hope this will be fixed asap so ACE wouldn't give false errors.

@msgannon
Copy link

I have the same problem. I DID add it to the metadata elements. For some of the elements Epub Checker didn't like it, so removed those. ACE didn't pick up that it was on the individual elements. I've decided to leave it in the package tag and see if anyone complains...

@msgannon
Copy link

Epub 2 booted out with lang in the package element so just including it in the individual ones.

@gregoriopellegrino
Copy link

Thank you for your work on ACE. As the original reporter mentioned, specifying the xml:lang attribute on each individual metadata element should satisfy the language requirement, even if it's not on the parent package or metadata element. For example:

<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
	<meta xml:lang="it" name="generator" content="Adobe InDesign 19.3" />
	<meta name="cover" content="copertina.jpg" />
	<dc:title xml:lang="it">Il mio libro</dc:title>
	<dc:creator xml:lang="it">Gregorio Pellegrino</dc:creator>
	<dc:publisher xml:lang="it">Fondazione LIA</dc:publisher>
	<dc:date>2024</dc:date>
	<dc:rights xml:lang="it">© Fondazione LIA</dc:rights>
	<dc:language>it-IT</dc:language>
	<dc:identifier id="bookid">9788800000000</dc:identifier>
</metadata>

With this metadata, Ace still reports an error. It seems that Ace only checks if the xml:lang attribute is present on package or metadata, but not on individual elements.

Would it be possible to update ACE to check where the xml:lang attribute for each metadata supporting it (taking into account the inheritance system)? This would unblock the affected workflows and should work both with EPUB 2 and EPUB 3. Providing this flexibility for EPUB 2, especially as the transition to EPUB 3 is ongoing, would be greatly appreciated.

Thank you for considering this request. I'm happy to provide any additional details or test files that could help reproduce and resolve this issue.

Do you have a timeline for this development? It is blocking some workflows for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants