Skip to content

Commit

Permalink
use allowLocaleSwitching to control default for supportsVoicing
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Feb 17, 2023
1 parent aa18b48 commit 2eb0988
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/preferences/PreferencesModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,16 @@ export default class PreferencesModel extends PhetioObject {
}, options.visualOptions );

// For now, the Voicing feature is only available when we are running in the English locale, accessibility
// strings are not made available for translation. When running with multiple locales, the voicing feature
// is supported if English is available, but not enabled until English becomes the running locale.
// strings are not made available for translation. When running with dynamic locales, the voicing feature
// is supported if English is available, but will be disabled until English is selected.
const supportsVoicing = options.audioOptions.supportsVoicing &&
SpeechSynthesisAnnouncer.isSpeechSynthesisSupported() &&
_.some( localeProperty.validValues, value => value.startsWith( 'en' ) );
(
// Running with english locale OR an environment where locale switching is supported and
// english is one of the available languages.
phet.chipper.locale.startsWith( 'en' ) ||
( phet.chipper.allowLocaleSwitching && _.some( localeProperty.validValues, value => value.startsWith( 'en' ) ) )
);

// Audio can be disabled explicitly via query parameter
const audioEnabled = phet.chipper.queryParameters.audio !== 'disabled';
Expand Down

0 comments on commit 2eb0988

Please sign in to comment.