-
Notifications
You must be signed in to change notification settings - Fork 6
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
Region and Culture query parameter should be graceful and future proof #974
Comments
Noting that @samreid may be working on a couple more Region and culture sims in the coming months. |
Here is a first pass on this feature.
|
I'd next like to discuss this with @marlitas since she was one of the original authors. I don't think it will be too challenging to get to a commit point here. I doubt we will want to maintenance release this, but we may need it for partners. |
I discussed this with @marlitas today. We believe we want to MR this grace. Here is @marlitas's list of sims published with regionAndCulture, but she mentioned that another good way to check support is with the simFeatures package flag called Number Line: Operations |
@marlitas and I went through the changes, and decided that adding graceful handling for the Property values itself is not desirable. We still want validValues for regionAndCultureProperty, and to have an assertion if trying to set the value to an unsupported regionAndCulture. This logic differentiation is acceptable because phet-io clients have the ability to see what the valid entries are for a given sim through its state:
Whereas, the query parameter is more teacher facing, and so needs to be much more user friendly with a fallback to the default instead of a query parameter dialog error. Side quests (not needed for the maintenance release):
Here is the likely final MR changes. Subject: [PATCH] allow grace to regionAndCulture, https://github.com/phetsims/joist/issues/974
---
Index: joist/js/i18n/regionAndCultureProperty.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/joist/js/i18n/regionAndCultureProperty.ts b/joist/js/i18n/regionAndCultureProperty.ts
--- a/joist/js/i18n/regionAndCultureProperty.ts (revision dc5839729a99e2dd02cd26267155b1ac0c5f593e)
+++ b/joist/js/i18n/regionAndCultureProperty.ts (date 1738171924503)
@@ -69,9 +69,8 @@
return !!( regionAndCulture && supportedRegionAndCultureValues.includes( regionAndCulture ) );
};
-const initialRegionAndCulture: RegionAndCulture = window.phet.chipper.queryParameters.regionAndCulture;
-assert && assert( isSupportedRegionAndCulture( initialRegionAndCulture ),
- `Unsupported value for query parameter ?regionAndCulture: ${initialRegionAndCulture}` );
+const initialRegionAndCulture: RegionAndCulture = isSupportedRegionAndCulture( window.phet.chipper.queryParameters.regionAndCulture ) ?
+ window.phet.chipper.queryParameters.regionAndCulture : DEFAULT_REGION_AND_CULTURE;
// Globally available, similar to phet.chipper.locale, for things that might read this (e.g. from puppeteer in the future).
phet.chipper.regionAndCulture = initialRegionAndCulture;
Index: chipper/js/browser/initialize-globals.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/chipper/js/browser/initialize-globals.js b/chipper/js/browser/initialize-globals.js
--- a/chipper/js/browser/initialize-globals.js (revision 7fe27b2f766c62c06e7b620e17551aa8c5ad65aa)
+++ b/chipper/js/browser/initialize-globals.js (date 1738170813670)
@@ -469,8 +469,7 @@
regionAndCulture: {
public: true,
type: 'string',
- defaultValue: packagePhet?.simFeatures?.defaultRegionAndCulture ?? 'usa',
- validValues: packagePhet?.simFeatures?.supportedRegionsAndCultures ?? [ 'usa' ] // default value must be in validValues
+ defaultValue: packagePhet?.simFeatures?.defaultRegionAndCulture ?? 'usa'
},
/** |
|
I wrote a script to determine what published sim versions had
The differences between this list and @marlitas' above are that this list doesn't have CAV (expected), and also Number Line Operations). I didn't see NL:Operations published with region and culture on the website, or locally, so I'm going to proceed leaving it out of the list. Although, I do see an error when using the parameter:
|
For QA to test: For all sims:
For any sim in this list: #974 (comment)
|
…/chipper#1552, lint breaks windows builds, phetsims/joist#974, phetsims/chipper#1554
…/chipper#1552, lint breaks windows builds, phetsims/joist#974, phetsims/chipper#1554
…/chipper#1552, lint breaks windows builds, phetsims/joist#974, phetsims/chipper#1554
…/chipper#1552, lint breaks windows builds, phetsims/joist#974, phetsims/chipper#1554
From conversations in https://docs.google.com/document/d/1-nqTlDtLtPB8JrdDrE8KdJB-4Phwe6QvTV_UnsZrteg/edit and
phetsims/projectile-data-lab#324
Design requirements:
Designers are accepting of two solutions, up to devs what is easiest/best
@jonathanolson @brent-phet and I are going to pursue the "no validation" strategy for this.
open questions:
The text was updated successfully, but these errors were encountered: