phetsims / equality-explorer

"Equality Explorer" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 3 forks source link

Add support for dynamic locale #187

Open pixelzoom opened 2 years ago

pixelzoom commented 2 years ago

Requested by @kathy-phet. Includes equality-explorer-basics and equality-explorer-two-variables.

pixelzoom commented 2 years ago

The bulk of this work is done. But...

There are 2 remaining TODOs, labeled with:

//TODO https://github.com/phetsims/equality-explorer/issues/187 must be disposed because it links to a translated string Property

These TODOs involve cases where a variable symbol ('x', 'y') appears in an equation. Those variable symbols are translated strings -- xStringProperty and `yStringProperty, to be specific. Equations are created dynamically, and therefore must be disposed in order to unlink from those StringProperties. The problem is that we have no reference to the Nodes, they are buried deep in a scenegraph fragment, so cannot call dispose.

So this sim now has a significant memory leak.

pixelzoom commented 2 years ago

I addressed the easier of the two memory leaks in the commit above.

pixelzoom commented 2 years ago

The more difficult memory leak was addressed in the above commit, by factoring out class ExpressionNode, with its own dispose method.

pixelzoom commented 2 years ago

Support for dynamic locale is complete. This sim was relatively easy (4.25 hours) because it does not have many strings.

@amanda-phet ready for review.