Fix error when a synthesizer don't expose available languages#20100
Merged
Conversation
seanbudd
approved these changes
May 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an AttributeError raised when NVDA checks whether a language is supported by the current synthesizer and the synthesizer reports an invalid/empty available language entry (notably None). This sits in the speech language-reporting path (used by language reporting / automatic language switching features), where robustness is important to avoid repeated log errors during normal speech output.
Changes:
- Add a guard in
SynthDriver.languageIsSupportedto skipNoneentries inavailableLanguages. - Add a changelog entry documenting the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
source/synthDriverHandler.py |
Avoids calling language normalization on None entries when checking synthesizer language support. |
user_docs/en/changes.md |
Documents the bug fix in the 2026.2 changelog. |
Comment on lines
347
to
351
| for availableLang in self.availableLanguages: | ||
| if ( | ||
| if availableLang is not None and ( | ||
| lang == languageHandler.normalizeLanguage(availableLang) | ||
| or lang == languageHandler.normalizeLanguage(availableLang).split("_")[0] | ||
| ): |
Comment on lines
340
to
350
| def languageIsSupported(self, lang: str | None) -> bool: | ||
| """Determines if the specified language is supported. | ||
| :param lang: A language code or None. | ||
| :return: ``True`` if the language is supported, ``False`` otherwise. | ||
| """ | ||
| if lang is None: | ||
| return True | ||
| for availableLang in self.availableLanguages: | ||
| if ( | ||
| if availableLang is not None and ( | ||
| lang == languageHandler.normalizeLanguage(availableLang) | ||
| or lang == languageHandler.normalizeLanguage(availableLang).split("_")[0] |
|
|
||
| ### Bug Fixes | ||
|
|
||
| * Fixed an error when a synthesizer doesn't have available languages, and NVDA tries to report if a language is supported. (#20080, @nvdaes) |
Member
|
oops - these are all good comments. Might be worth a follow up. |
5 tasks
seanbudd
pushed a commit
that referenced
this pull request
May 15, 2026
None. Fixup of PR #20100 Summary of the issue: Synthesizers may return None for normalized languages, and this is not addressed in #20100. Description of user facing changes: None known. Description of developer facing changes: None. Description of development approach: Considered the situation where the normalized language is None, improved the function to check if a language is supported, and added unit tests for this function.
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.
Link to issue number:
Fixes #20080
Summary of the issue:
When NVDA is configured to report if the language of the text been read is supported, an error is produced if the syntesizer exposes available languages as None.
Description of user facing changes:
Fixed an error with certain syntesizers when reporting if the language of the text been read is supported.
Description of developer facing changes:
Description of development approach:
Check if available language is None.
Testing strategy:
None yet.
Known issues with pull request:
None.
Code Review Checklist: