Skip to content

Fix language override persisting after leaving multilingual content#100

Open
akj wants to merge 2 commits intofastfinge:masterfrom
akj:fix/language-override-leak
Open

Fix language override persisting after leaving multilingual content#100
akj wants to merge 2 commits intofastfinge:masterfrom
akj:fix/language-override-leak

Conversation

@akj
Copy link
Copy Markdown
Collaborator

@akj akj commented Mar 27, 2026

Fixes #97

Summary

  • When automatic language switching activates (e.g. visiting an English website with NVDA set to German), the switched voice leaked into subsequent speak() calls that contained no LangChangeCommand — such as pressing Win+M to go to the desktop.
  • At the start of each speak() call, if a language override is active, reset the voice back to _defaultVoice. This mirrors the existing prosody reset pattern (issue Rate state leak in ETI-Eloquence 64-bit when using NVDA RateCommand (possible driver-level handling issue) #59). If the new speech sequence contains its own LangChangeCommand, it will override this reset as expected.

Test plan

  • Set NVDA language to German (or any non-English language) with automatic language switching enabled
  • Visit an English website so Eloquence switches to the English voice
  • Press Win+M or switch to another application
  • Verify Eloquence speaks in German again (the configured default)
  • Return to the English website and verify it still switches to English correctly

@akj
Copy link
Copy Markdown
Collaborator Author

akj commented Apr 4, 2026

@amenaide does this updated pr fix your remaining issues?

akj added 2 commits April 4, 2026 11:03
…astfinge#97)

When automatic language switching activates (e.g. on an English website
with NVDA set to German), the voice change leaked into subsequent speech
sequences that contained no LangChangeCommand. Reset the voice to the
user's default at the start of each speak() call when a language
override is active.
…nge#97 cases

The initial fix reset the voice at the start of each speak() call, but
NVDA's SpeechManager carries the document language into subsequent speech
sequences (menus, desktop, role names), immediately overriding the reset.

Use cancel() as a context-switch signal: when speech is cancelled while a
language override is active, record the overridden voice and suppress the
first LangChangeCommand in the next speak() that re-applies it.  This
handles UI speech (desktop, Alt menus, NVDA menu, role names) without
breaking continuous foreign-language reading in sayAll mode, where
cancel() is not called between speak() invocations.
@akj akj force-pushed the fix/language-override-leak branch from b3176a5 to 0857d27 Compare April 4, 2026 15:03
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

Successfully merging this pull request may close these issues.

Automatic language switching doesn't work correctly when NVDA is not set to English

1 participant