Repository navigation
feat: per-book language for read-aloud voices and hyphenation (stacked on #302, refs #286) - #303
Merged
Merged
Conversation
chortya
force-pushed
the
up/feat-epub-book-language
branch
from
October 21, 2026 06:20
b8bdb8b to
6474052
Compare
4 tasks done
Owner
chortya
force-pushed
the
up/feat-epub-book-language
branch
from
October 21, 2026 14:50
6474052 to
b76a3d2
Compare
Contributor
Author
Owner
|
Thanks @chortya, the language picker and live voice switching look really good. When you rebase, could you also make sure a book’s language choice stays separate between different servers or accounts? I could see the same book ID on another server picking up the old choice. |
Readium picks one read-aloud language (book metadata, else the device locale) and lists only its voices, with no way to change it; the hyphenation fallback made the same assumption. Adds a Book language setting to the in-book options (This book): Auto shows whether it comes from the book or the device, and an override is remembered per book, sent to the EPUB navigator for hyphenation and to the read-aloud navigator for voices, and applied live during playback. Tests: JVM resolution and option rules; on-device voice lists with the system speech engine (Auto, live switch, start in override), page language and persistence across recreation, and the picker UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge picker - A book-language (or voice setting) change made while read-aloud is preparing is applied once the navigator exists. - The book-language picker is a dialog with a lazy list instead of a menu composing ~200 items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anguage Readium only injects its language into documents whose <html> declares none. The current-document bridge now also sets the override on <html> and <body> (lang and xml:lang) and restores the publisher's values on Auto, so hyphenation follows the chosen language in every chapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same book ID can exist on another server or account, so the per-book language override is now keyed by the active server profile (the boundary van-geaux#309 uses for downloads and snapshots) as well as the reader key. Choices now survive switching profiles instead of being wiped for every profile. Signing out clears only the signed-out profile's choices, for BookOrbit, Kavita and Komga alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chortya
force-pushed
the
up/feat-epub-book-language
branch
from
October 23, 2026 08:21
b76a3d2 to
4fc8250
Compare
Contributor
Author
|
Thanks, good catch. Rebased onto current
Tests: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution pause
The maintainer lifted the pause and invited split PRs in #286.
Summary
Read-aloud only offers voices for the EPUB's declared language. Books with a wrong or missing
dc:language(common in converted files) therefore got the wrong voice list, e.g. only Dutch voices for an English book, and the wrong hyphenation patterns.language, for hyphenation) and the read-aloud navigator (AndroidTtsPreferences.language, which selects the voice list). Both apply live, even while speaking. A change made while read-aloud is still preparing is applied once its navigator exists.languageinto documents whose<html>declares none, so the reader's existing current-document bridge also sets an override on<html>/<body>(langandxml:lang) and restores the publisher's values on Auto.xml:langstill works), and read-aloud keeps Readium's own choice.readium_epub_book_languages, keyed by reader key, not written in Preview, cleared on logout).Verification
./gradlew :app:testDebugUnitTest— 961/961 pass (newEpubBookLanguageTest: resolution order, navigator/TTS language rules, store, document-language script).:app:lintDebug— 0 errors.:app:assembleDebugsucceeds. No added trailing whitespace; line endings preserved.EpubBookLanguageInstrumentedTest5/5 — read-aloud offers the book language's voices by default and the override's voices live; read-aloud starts in the override language; a change during read-aloud preparation is applied; the page language follows the override live and is remembered per book; a chapter that declares its ownlang/xml:langtakes the override and gets its own value back on Auto (this test fails without the fix below).EpubReaderOptionsOverlayInstrumentedTest5/10 (the new book-language option test passes; the same 5 fail onmainon this emulator).ReadiumEpubOpenInstrumentedTest16/18 andEpubMediaOverlayControlsInstrumentedTest3/4 — same failures as onmainon this emulator.injectLangkeeps a chapter's ownlang/xml:lang, so the override did not reach hyphenation in such books. Fixed as above; the re-review found no remaining issues.🤖 Generated with Claude Code