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

TTS: Preference to force override the language set in the HTML resources #279

Open
morismoris opened this issue Mar 24, 2023 · 4 comments
Open
Labels
feature request Something is missing

Comments

@morismoris
Copy link

Bug Report

It looks like the system only gives the possibility to listen to the ebook in the language set in the file's LANG metatag: if I try to change the language, the ebook is still read in the language set by the LANG meta tag.

Unfortunately, we don't know which and how many ebooks in our catalog could have this problem, so we need to know how to work around the problem and provide an acceptable quality text-to-speech to our iOS readers.

What happened?

The text-to-speech allows me to listen to it only in English: if I set Italian, this change is not accepted.

Expected behavior

I'd like to set Italian.

How to reproduce?

I attach an epub, a classic of Italian literature in which the metatag is set on EN.
Canne_al_vento test lingua.zip

Environment

  • Readium version: 2.4.0

I can't test with the TestApp ('main' or 'develop' branch), because the TestApp fails with the error:
Missing file: "/META-INF/container.xml"

Development environment

macOS: 13.2.1
platform: x86_64
carthage: 0.38.0
Xcode 14.2
Build version 14C18

Testing device

  • iOS version:
  • Model (e.g. iPhone 11 Pro Max):
  • Is it an emulator? Yes or No

Additional context

@mickael-menu
Copy link
Member

The Readium TTS allows to override the publication language, except if it's explicitly set in the HTML document. Unfortunately this book is badly authored as the HTML documents have xml:lang="en" despite the content being in Italian:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE html>
<html xml:lang="en">
<p>Di là andarono alla festa dello Spirito Santo. Il cieco sapeva bene il tempo d’ogni festa e l’itinerario da seguirsi ed era lui che guidava il compagno.

We plan to improve the TTS navigator by adding a preference to force override the content language, but I have no ETA for this change.

In the meantime, I think that if you switch the utterance.language and config.defaultLanguage precedence here it should work:

return .right(utterance.language
?? config.defaultLanguage
?? publication.metadata.language
?? Language.current
)

Note that this means that multilingual books won't behave correctly if you set config.defaultLanguage, as the elements languages will be ignored.

@mickael-menu mickael-menu added the feature request Something is missing label Mar 24, 2023
@mickael-menu mickael-menu changed the title TTS: I cannot choose the language freely. TTS: Preference to force override the language set in the HTML resources Mar 24, 2023
@morismoris
Copy link
Author

Ok, it's works... but how can I preselect the right Language in TTSSettings? It seems that it doesn't work anycase also in Epub with the right lang.

@mickael-menu
Copy link
Member

I don't understand what you mean?

@morismoris
Copy link
Author

morismoris commented Mar 27, 2023

I open the book
IMG_0549

I start the TTS
IMG_0550

I open the TTS Settings, no language is preselected
IMG_0551

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

No branches or pull requests

2 participants