Report the language of the text been read (#17685)
Summary of the issue:
Users may want to know the language of the text been read, and if the current synthesizer can switch to that language.
Description of user facing changes
In the speech settings panel, a checkbox can be used to determine if the language of the read text should be reported when language detection is enabled.
In the speech settings panel, a combo box is added to choose if NVDA should report if the language is supported by the current synthesizer. Available options are: off, beep or speech.
Added an unassigned command in the caret system category to know the language of the character positioned at the caret.
Description of development approach
In speech/__init__.py, a function is registered (and unregistered) with the filter_speechSequence extension point, to insert the language description (or language code if the description is not available), when a langChangeCommand is found in the sequence to be spoken. The language description won't be inserted if the language command is the last item of the speech sequence, or if lang is None, or if it's the last reported language, or if reportLanguage and reportNotSupportedLanguage options are False. A SpeechSequence member has been added to the SpeechState class to track the last reported language, as well as another function to check and report if the language is supported by the current synthesizer.
LangChangeCommand has methods to determine if the language should be processed by NVDA or the synthesizer.
A new languageHandling.py file has been added to speech to filter speech sequences, adding language descriptions or beep commands to report language as appropriate.
In globalCommands.py, a script has been added to report the language of the character at caret.