Announce capital indicators during character-by-character selection#19505
Conversation
… now announce capital letters with the same indicators used during character-by-character navigation
|
cc @CyrilleB79 @seanbudd, I would love to hear your thoughts on the situation I mentioned in the "Known issues with pull request" section. Thanks for your help! |
|
If I'm correct, these messages are reported when using selection / deselection commands. Thus it is more important to know what has been selected / deselected first and then to append "selected" or "deselected" as already done in most languages. Thus, you should try to contact all translators who have not "%s" at the beginning of the translated string and discuss with them if they agree to put "selected" / "deselected" at the end, explaining why (information most important first). They may accept or decline this proposal, if possible with an explanation. Then there are two possibilities:
|
|
To be more specific, I have scanned the existing translations. It appears that Vietnamese (vi) is the only language currently with an inconsistent format regarding the placement of
I am not sure if any translators responsible for the Vietnamese localization will see this PR. It would be great if someone could help CC them so we can discuss if they would be open to moving Furthermore, I am concerned that the 13 untranslated languages might also require placing |
Most translators do not follow PRs or issues on NVDA's GitHub repo.
Even if we need to ask confirmation to the Vietnamese translator for correctness, I am almost sure that the order can be with the placeholder ( Thus, I think we do not need to bother with untranslated languages. This string is quite old so translators have had time to translate it if they wish. And if in the future your new code causes a problem when translating a specific language, we may change the design again, based on this real-life problem. |
|
This is a fascinating linguistics problem. Doing a bit of research, Vietnamese is only the canary in the coal-mine for this. Other
Forcing the "A selected" structure in Vietnamese results in a sentence closer in meaning to "A has selected [something]". That being said, Vietnamese allows slightly longer passive phrasings that would allow the "A selected" structure. That language has the capability to make the "A selected" structure work in a grammatically correct way. Given there are other VSO languages, we may also want to check with translators from those community how they've handled it. |
|
Thanks @CyrilleB79 and @gerald-hartig I've posted a new topic in Translation Group: |
|
Hi @seanbudd and @SaschaCowley Thanks for the suggestions! I've updated the implementation:
|
|
FYI, there is an answer from the Vietnamese translator on the translators mailing list:
Given your last changes, this may not be needed anymore though. |
c575308 to
5e3cbd2
Compare
|
Thanks @CyrilleB79, |
5e3cbd2 to
9fe861e
Compare
|
I've reverted the generator approach and returned to the list-based implementation with localization fixes. |
SaschaCowley
left a comment
There was a problem hiding this comment.
This is looking really good, but I did find a problem when testing, though I think the fixes should be quite easy.
…Utterance parameter.
|
Hello @SaschaCowley |
… for selection to avoid suffix being spelled out
…ed; update tests to expect 2-space separator
…leed from capitals; update tests to expect 2-space separator
0474bf0 to
52e7e60
Compare
There was a problem hiding this comment.
Pull request overview
This pull request fixes an issue where NVDA did not announce capital indicators (pitch change, "cap" prefix, beeps) when selecting text character-by-character using Shift+Arrow keys. Previously, only the character itself was announced without any capitalization cues.
Changes:
- Modified single-character selection announcements to use
getSpellingSpeechto leverage existing capital indication logic - Fixed
_getSpellingSpeechAddCharModeto properly close CharacterModeCommand at sequence end - Updated function signatures to accept
SpeechSequencein addition tostrfor selection announcements
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| source/speech/speech.py | Core implementation: routes single-character selections through getSpellingSpeech to apply capital indicators; adds parameters to control utterance endings and character mode; enhances _getSelectionMessageSpeech to handle speech sequences; fixes CharacterModeCommand closure bug |
| tests/unit/test_speech.py | Updates test to expect CharacterModeCommand(False) at sequence end, reflecting the bug fix |
| tests/system/robot/symbolPronunciationTests.py | Adjusts expected spacing in character selection tests to account for speech sequence processing |
| user_docs/en/changes.md | Documents the bug fix in the changelog |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for this PR; it's been needed for a long time!
|
Link to issue number:
Fixes #18360
Summary of the issue:
When selecting text character by character (e.g., Shift+Arrow keys), NVDA does not announce capital letters with the configured indicators (pitch change, "cap" prefix, etc.), unlike standard character navigation. This makes it difficult to distinguish case during selection.
Description of user facing changes:
When selecting or unselecting a single character, NVDA will now announce capital letters using the currently configured capital indication settings.
Description of developer facing changes:
source/speech/speech.py:speakSelectionChangeto detect single-character selection/unselection._getSingleCharSelectionSpeech,_speakSingleCharSelected,_speakSingleCharUnselected) to generate speech sequences usinggetSpellingSpeech, ensuring capital indicators are applied.Description of development approach:
The implementation routes single-character selection events through
getSpellingSpeechto leverage existing capital indication logic.Testing strategy:
Manual testing:
Known issues with pull request:
%s selected). Analysis shows that some languages (e.g., Vietnameseđã chọn %s) expect the status message before the character.%sand insert the character speech sequence accordingly. This is necessary becauseSpeechSequenceobjects cannot be directly formatted into strings using standardgettextinterpolation.Code Review Checklist: