From 2eb0988aea1ac0250bd6bcf2ef9ed76f05a52a60 Mon Sep 17 00:00:00 2001 From: Jesse Date: Fri, 17 Feb 2023 12:06:30 -0500 Subject: [PATCH] use allowLocaleSwitching to control default for supportsVoicing --- js/preferences/PreferencesModel.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/preferences/PreferencesModel.ts b/js/preferences/PreferencesModel.ts index e1216775..66eedfb8 100644 --- a/js/preferences/PreferencesModel.ts +++ b/js/preferences/PreferencesModel.ts @@ -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';