Make detection of not supported languages more robust#20111
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens NVDA’s “is this language supported by the current synthesizer?” check by safely handling language codes that can’t be normalized (e.g. meta languages like x-*) and adds unit tests to prevent regressions.
Changes:
- Update
SynthDriver.languageIsSupportedto normalize input/available languages once, ignore invalid/Noneentries, and avoid crashes when normalization returnsNone. - Add focused unit tests covering
None, exact matches, root-language matches, unsupported languages, and meta languages. - Update the 2026.2 changelog entry wording to reflect the underlying failure mode more accurately.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| user_docs/en/changes.md | Adjusts the release note wording for the bug fix. |
| tests/unit/test_synthDriverHandler.py | Adds unit tests for SynthDriver.languageIsSupported. |
| source/synthDriverHandler.py | Makes language support detection robust against unnormalizable language codes. |
|
Please retarget this at beta |
|
Could we also consider binding the reporting of not supported languages to |
|
@leonard wrote:
I find the option very verbose too. This is targeted to beta, and this was requested by @seanbudd . So I think we should wait for feedback from NV Access, in case we should open a new issue. |
Link to issue number:
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.
Testing strategy:
Tested Reading text of the following Codepen pages, based on tests proposed by @CyrilleB79:
-webpage with English, French an Italian
Also, run unit tests.
Known issues with pull request:
None.
Code Review Checklist: