Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic translation feature #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cary-rowen
Copy link

PR Description

New Feature
A new autoTranslate layer command is introduced to control whether automatic translation is enabled. This feature automatically translates the last spoken text by NVDA into a specified language, reducing the need for frequent manual translation.

Default State

  • The auto-translate feature is disabled by default.

User Interaction

  • Users can toggle the auto-translate feature via the V command in the layer commands, or bind it to other gestures.

Method Changes

  • translateAndCache:
    • In auto-translate mode, if translation fails, the original text will be read aloud without a failure message.
    • In non-auto-translate mode, if translation fails, the message “Translation failed” is announced (default behavior).

Change Overview

  • script_toggleAutoTranslate: Toggles the auto-translate mode.
  • _localSpeak: In auto-translate mode, translates and speaks the translated text; if translation fails, the original text is spoken.
  • script_ITLayer: Adds the V key as a shortcut to toggle the auto-translate mode after NVDA+Shift+t.

Test Cases

  • Verify the behavior when translation succeeds or fails in auto-translate mode.
  • Verify the behavior when switching the auto-translate mode and ensure it functions as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant