Skip to content

fix(tts): prefer an installed voice for locale-only tags#21378

Open
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/tts-local
Open

fix(tts): prefer an installed voice for locale-only tags#21378
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/tts-local

Conversation

@criticalAY

Copy link
Copy Markdown
Contributor

Note

Assisted-by: Claude Opus 4.8- Writing tests

Purpose / Description

When a card template uses a locale-only native TTS tag such as {{tts fr_FR:Front}} (no explicit voices=), AnkiDroid could pick a voice that is not installed and fail playback with ERROR_NOT_INSTALLED_YET, even when an installed voice for that language was available. So I am fixing that in this PR

Fixes

Approach

See commit

How Has This Been Tested?

Unit tests and verified on Pixel 10 (reproduced the issue then build again on fix - works fine)

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

For a locale-only tag such as {{tts fr_FR:Front}}, voiceForTag fell
back on the first voice matching the language without checking
availability. Android can list voices flagged KEY_FEATURE_NOT_INSTALLED,
so an uninstalled voice could be chosen and fail on playback with
ERROR_NOT_INSTALLED_YET even when an installed voice for that language
was available.

The language fallback now prefers an installed voice, only settling for
an unavailable one when nothing else matches.

Assisted-by: Claude Opus 4.8 - Writing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Locale-only {{tts}} selects an unavailable voice instead of an installed voice

1 participant