phetsims / fourier-making-waves

"Fourier: Making Waves" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
6 stars 3 forks source link

Finish support for dynamic locale #225

Open pixelzoom opened 1 year ago

pixelzoom commented 1 year ago

This sim mostly supports dynamic locale. But there's still one remaining task. In EquationMarkup, all occurrences of "StringProperty.value" should just be "StringProperty".

This will be a significant chunk of work. EquationMarkup is a set of utility functions that create fragments of various equations. And when locale changes, those equations need to update their translated symbols.

For equations, it might be easier (certainly more efficient) to observe localeProperty, and rebuilt the equations when the locale changes.

localeProperty is a singleton, imported via:

import localeProperty from '../i18n/localeProperty.js';
pixelzoom commented 1 year ago

For equations, it might be easier (certainly more efficient) to observe localeProperty, and rebuilt the equations when the locale changes.

Probably not a good idea, because it creates listener-order dependencies. Something is presumably observing localeProperty and updating the sim's localized StringProperties. And that observer would need to run first, so that the StringProperties were updated before Fourier's equation were updated. That will certainly happen with the current order that observers are added, but would presumably fail if the observers list is shuffled.

pixelzoom commented 6 months ago

Support for dynamic locale has been completed. This will need to be reviewed before the sim is republished from main.