Skip to content

Drop unsupported language switching commands for OneCore#13779

Merged
seanbudd merged 8 commits into
masterfrom
fixOneCoreLangSwitching
Jun 10, 2022
Merged

Drop unsupported language switching commands for OneCore#13779
seanbudd merged 8 commits into
masterfrom
fixOneCoreLangSwitching

Conversation

@seanbudd

@seanbudd seanbudd commented Jun 9, 2022

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #13732

Summary of the issue:

OneCore keeps a cache of voices for NVDA in the registry.
OneCore fails to automatic language switch when remnants of a previously installed OneCore language exist in the cache.
This causes speech to not be announced.

This is only an issue for installed copies, as portable copies bypass the NVDA OneCore cache.

Description of how this pull request fixes the issue:

Drop the language change command if a given language is unsupported by OneCore.

Testing strategy:

Manual testing

Using the following HTML sample, test language switching.
Replace the language code "zh" as appropriate.

data:text/html,<p>Hello</p><p lang="zh">world</p>.

Using installed oneCore languages 'en_au', 'fr_fr', 'en_us', 'zh_hk'

Automatic language switching is successful for the following language codes:

  • "en" (to en_US)
  • "en_AU"
  • "en-AU"
  • "en-au"
  • "en_AU"
  • "fr-fr"
  • "fr" (to fr_FR)
  • "zh" (to zh_hk)
  • "zh_hk"

Automatic language switching reverts to the default voice for the following language codes:

  • "FakeLang_fakeLocale" (illegitimate language)
  • "en-CA" (unsupported locale)
  • "ta" (unsupported language)

Known issues with pull request:

None

Change log entries:

Bug fixes

- Fix automatic language switching failing with OneCore when trying to switch to a formerly installed language. (#13732)

Code Review Checklist:

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

@seanbudd seanbudd requested a review from a team as a code owner June 9, 2022 02:50
@seanbudd seanbudd requested a review from feerrenrut June 9, 2022 02:50
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 700ad28992

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good.

Comment thread source/synthDrivers/oneCore.py Outdated

import os
import sys
from typing import Any, Callable, Generator, List, Optional, Set, Tuple, Union

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We get better diffs for subsequent updates if these are one per line:

Suggested change
from typing import Any, Callable, Generator, List, Optional, Set, Tuple, Union
from typing import (
Any,
Callable,
Generator,
List,
Optional,
Set,
Tuple,
Union,
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in e630724

Comment on lines +109 to +110
defaultLanguage: str,
availableLanguages: Set[str],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add docs for these, examples are specifically helpful. Are they expected to be 'en' or 'en-au' etc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These are both fully qualified OneCore language codes, e.g. "en_US".

Comment on lines +111 to +113
rate: float,
pitch: float,
volume: float,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume these are expected to be 0->1 values, if you can confirm please add to the doc string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is actually from 0-100, but supports decimal changes

Comment thread source/synthDrivers/oneCore.py Outdated
Comment on lines +166 to +167
_ocSpeechToken: Optional[ctypes.POINTER]
_queuedSpeech: List[Union[str, Tuple[Callable[[ctypes.POINTER, float], None], float]]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this typing be in the init method? Doesn't having it here indicate these are expected to be used as class variables?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in e630724

@CyrilleB79

Copy link
Copy Markdown
Contributor

Hello
I have just tested nvda_snapshot_pr13779-25537,4aba6cc9.exe:

  • From the launcher, the test is OK. I get a warning for each English text, what is normal due to my broken English voices.
  • From a portable copy, I get a critical error: nvda-old.log
    However, the issue is also present on last alpha portable (nvda_snapshot_alpha-25538,f3445949.exe): cf. nvda-old.log

@seanbudd

Copy link
Copy Markdown
Member Author

@CyrilleB79 - it looks like you've found a new regression in 2022.2 for portable copies of NVDA.
This needs a new issue and investigation.

@seanbudd seanbudd requested a review from feerrenrut June 10, 2022 00:02
@seanbudd seanbudd mentioned this pull request Jun 10, 2022
3 tasks

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assuming the build passes.

@seanbudd seanbudd merged commit 4eb30c9 into master Jun 10, 2022
@seanbudd seanbudd deleted the fixOneCoreLangSwitching branch June 10, 2022 07:36
@nvaccessAuto nvaccessAuto added this to the 2022.2 milestone Jun 10, 2022
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.

Error with OneCore voice and automatic language switching in NVDA2022.1

5 participants