Closed samreid closed 1 year ago
There are no stringProperty
in 1.5, and here are all the textProperty
:
I used this code in the console to set all textProperty
to 'hello' in 1.5. You can see it is not very good coverage:
_.keys(phet.phetio.phetioEngine.phetioObjectMap).filter(k=>k.endsWith('textProperty')).forEach(phetioID => {phet.phetio.phetioEngine.phetioObjectMap[phetioID].value = 'hello';});
I thought it would work to add TandemFragmentRenamed rules, but somehow that state "hello" is not getting through:
new TandemFragmentRenamed( 'gravityAndOrbits.general.view.navigationBar.titleText.textProperty', 'gravityAndOrbits.general.view.navigationBar.titleText.stringProperty' ),
new TandemFragmentRenamed( 'gravityAndOrbits.general.view.navigationBar.modelScreenButton.text.textProperty', 'gravityAndOrbits.general.model.strings.gravityAndOrbits.modelStringProperty' ),
new TandemFragmentRenamed( 'gravityAndOrbits.modelScreen.view.playAreaNode.starPlanetSceneView.timeCounter.clearButton.textNode.textProperty', 'gravityAndOrbits.general.model.strings.gravityAndOrbits.clearStringProperty' )
@zepumph do we need a different kind of migration rule for things like this? Or is something broken about TandemFragmentRenamed? Or am I confused or using it wrong?
@samreid and I discussed and we found 2 problems:
gravityAndOrbits.general.model.strings.gravityAndOrbits.gravityAndOrbits.titleStringProperty
From here we think @samreid should add rules for all featured text in 1.5, but not for ALL texts. Let's at least start there.
A better script:
_.keys(phet.phetio.phetioEngine.phetioObjectMap).filter(k=>k.endsWith('textProperty')).forEach(phetioID => {phet.phetio.phetioEngine.phetioObjectMap[phetioID].value = 'hello'+(count++);});
A problem as I go about this. In 1.5
gravityAndOrbits.${screen}.view.massesControlPanel.${sceneMassesControlPanel}.${body}ControlNode.massLabel.textProperty
,
copy-pasted the value of "Sun" 4x times, one for each control. In 1.6, these are all coalesced. So using the script above, in 1.5, I see suns labeled hello27, hello29, hello52 and hello54, but in 1.6 they are all coalesced to hello54.
OK using the scripts above I was able to migrate forward all of the customizable strings from 1.5. Summarizing caveats from above:
Perhaps a review?
Looks great thanks.
Tagging @arouinfar and @kathy-phet so they are aware of the "strings get coalesced" problem. In my opinion, it would be too complex to try to add heuristics to try to pick "the best" string to use. That mainly affects the body types in the play area and for the sliders (for this sim). Please open a separate issue if that requires further attention. Closing.
Migrate prior customized strings to new localized strings