Skip to content

Commit

Permalink
Check availableRuntimeLocales when determining isLocaleValid, see phe…
Browse files Browse the repository at this point in the history
…tsims/beers-law-lab#320

(cherry picked from commit 4889cfb)
  • Loading branch information
samreid authored and UniverseAndMore committed Feb 3, 2023
1 parent 6723404 commit 8cec7f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/i18n/localeProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export type Locale = keyof typeof localeInfoModule;
export const availableRuntimeLocales = Object.keys( phet.chipper.strings ).sort() as Locale[];

// Start only with a valid locale, see https://github.com/phetsims/phet-io/issues/1882
const isLocaleValid = ( locale?: Locale ) => {
return locale && localeInfoModule[ locale ];
const isLocaleValid = ( locale?: Locale ): boolean => {
return !!( locale && availableRuntimeLocales.includes( locale ) );
};

// We might use a partial locale (e.g. 'en' instead of 'en_US'), so grab this if it exists. It might be the same as
Expand Down

0 comments on commit 8cec7f6

Please sign in to comment.