Skip to content

Make detection of not supported languages more robust#20111

Merged
seanbudd merged 1 commit into
nvaccess:betafrom
nvdaes:fixupLangSupport
May 15, 2026
Merged

Make detection of not supported languages more robust#20111
seanbudd merged 1 commit into
nvaccess:betafrom
nvdaes:fixupLangSupport

Conversation

@nvdaes
Copy link
Copy Markdown
Collaborator

@nvdaes nvdaes commented May 11, 2026

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:

Also, run unit tests.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@nvdaes nvdaes marked this pull request as ready for review May 11, 2026 18:02
@nvdaes nvdaes requested a review from a team as a code owner May 11, 2026 18:02
@nvdaes nvdaes requested review from Copilot and seanbudd May 11, 2026 18:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.languageIsSupported to normalize input/available languages once, ignore invalid/None entries, and avoid crashes when normalization returns None.
  • 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.

@seanbudd seanbudd added this to the 2026.2 milestone May 12, 2026
@SaschaCowley
Copy link
Copy Markdown
Member

Please retarget this at beta

@SaschaCowley SaschaCowley added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label May 12, 2026
@seanbudd seanbudd changed the base branch from master to beta May 12, 2026 03:34
@LeonarddeR
Copy link
Copy Markdown
Collaborator

Could we also consider binding the reporting of not supported languages to reportLanguage as well? I enabled auto language switching for a moment and got overwhelmed by the amount of "not supported warnings". I think the current base level is too verbose.is to

@nvdaes
Copy link
Copy Markdown
Collaborator Author

nvdaes commented May 13, 2026

@leonard wrote:

Could we also consider binding the reporting of not supported languages to reportLanguage as well?

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.
I'm happy to change this to the current PR, though, so that not supported languages are reported just when report language is checked.

Comment thread source/buildVersion.py
@nvdaes nvdaes force-pushed the fixupLangSupport branch from 0dd0328 to 5d296c4 Compare May 14, 2026 16:54
@seanbudd seanbudd merged commit ddec731 into nvaccess:beta May 15, 2026
26 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants