-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for dynamic locale #319
Comments
I made an initial pass at this. What I discovered so far:
|
I punted on TypeScript conversion (#320) due to the effort required, and proceeded with adding support for dynamic locale. I made good progress, and I'd estimate that this is ~90% done. I had to undo a significant amount of work because of phetsims/chipper#1314, and I've added TODO comments in the code to revisit. I still need to figure out how to make One thing I learned during this conversion is that creating a DerivedProperty every Text/RichText is not alway the best solution. When there are multiple Text/RichText instances that have the same dependencies, and need to all be updated at the same time, it seems better to use a Multilink. See for example ProportionsBarNode.js There are also cases where dependencies are not created until after the Text/RichText is created, and Multilink is useful there too. |
Adding links from all Text nodes to their associated string Properties was a huge task. And I'm wondering about the value of doing this - it feels very over-engineered to me. In any case, it's done. I also replaced There are 2 TODOs in the code that still need to be addressed, and they require common code work in phetsims/chipper#1314 and phetsims/sun#746. So... I think this is at a place where it's ready for review by @amanda-phet and @kathy-phet. |
Notes from 9/1/2022 design meeting:
|
@pixelzoom I reviewed on master with The "No Data" title in the Proportions graph becomes uncentered when the string expands in size. |
"No Data" layout was fixed in the above commit. @arouinfar please review, close if OK. |
Looks good on master, thanks @pixelzoom. Closing. |
@jonathanolson @samreid and I had a discussion about dynamic locale and dynamic strings, and what needs to be done to support them. They suggested that I start with one sim, and Natural Selection seems to make the most sense, since it's next on the list in https://github.com/orgs/phetsims/projects/44.
To add support:
Convert from
string
toTReadonlyProperty<string>
instances from strings file. Do this everywhere that a string is used. Search for "naturalSelectionStrings." There are 93 occurrences.Use DerivedProperty for strings that involve a pattern. Search for "{{" in natural-selection-strings_en.json. There are 5 occurrences.
Run with
?locales=*
to enable the locale-testing button (globe) in the navigation bar. Open the locale dialog by pressing the globe button in the navigation bar. Press and hold while moving the pointer over locale names. This changes the locale. Watch for layout problems. Fix any layout problems that are identified. For example, if a Text node needs to remain centered on something, then a boundsProperty listener may be needed.@amanda-phet @kathy-phet FYI.
The text was updated successfully, but these errors were encountered: