phetsims / build-an-atom

"Build an Atom" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/build-an-atom
GNU General Public License v3.0
11 stars 10 forks source link

Spanish "es" translation of Build an Atom is not opening (the sim open in English) #242

Closed DianaTavares closed 1 week ago

DianaTavares commented 1 week ago

If you go to the Spanish website: https://phet.colorado.edu/es/simulations/build-an-atom and click in the simulation, it is going to open it in English: https://phet.colorado.edu/sims/html/build-an-atom/latest/build-an-atom_all.html?locale=es

But the strings are translated in the translation tool:

image

Looks like the problem is with the locale=es because with the other link, the sim open normal: https://phet.colorado.edu/sims/html/build-an-atom/latest/build-an-atom_es.html

zepumph commented 1 week ago

@jonathanolson can you take a look to start?

zepumph commented 1 week ago

I wonder if this is related to new locale work, currently being reviewed in https://github.com/phetsims/chipper/issues/1441

jonathanolson commented 1 week ago

On it.

jonathanolson commented 1 week ago

I think this might be cleanest to build simulations with --locales=* instead of only building specific locales. In discussion with @mattpen and @zepumph about it. If not:

build-an-atom 1.6 specific patch to fix:

Subject: [PATCH] fix patch
---
Index: js/grunt/getBuildConfig.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/grunt/getBuildConfig.js b/js/grunt/getBuildConfig.js
--- a/js/grunt/getBuildConfig.js    (revision 38f062b444c0bb7f75aada161b706d573f929274)
+++ b/js/grunt/getBuildConfig.js    (date 1720460658380)
@@ -347,6 +347,7 @@

   buildConfig.licenseKeys = getLicenseKeys( packageJSON, buildJSON, buildConfig.brand, buildConfig.preload );
   buildConfig.locales = getLocales( grunt, buildConfig.name );
+  buildConfig.allLocales = getLocalesFromRepository( buildConfig.name );
   buildConfig.availableLocales = [ ChipperConstants.FALLBACK_LOCALE ].concat( getLocalesFromRepository( buildConfig.name ) );

   grunt.log.debug( 'buildConfig=' + JSON.stringify( buildConfig, null, 2 ) );
Index: js/grunt/createHTMLFiles.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/grunt/createHTMLFiles.js b/js/grunt/createHTMLFiles.js
--- a/js/grunt/createHTMLFiles.js   (revision 38f062b444c0bb7f75aada161b706d573f929274)
+++ b/js/grunt/createHTMLFiles.js   (date 1720460695382)
@@ -229,13 +229,13 @@
     // Always include the fallback (en)
     var includedDataLocales = [ ChipperConstants.FALLBACK_LOCALE ];
     // Include directly-used locales
-    buildConfig.locales.forEach( function( locale ) {
+    buildConfig.allLocales.forEach( function( locale ) {
       includedDataLocales.push( locale );
     } );
     // Include locales that will fall back to directly-used locales
     Object.keys( fullLocaleData ).forEach( function( locale ) {
       if ( fullLocaleData[ locale ].fallbackLocales && fullLocaleData[ locale ].fallbackLocales.some( function( fallbackLocale ) {
-        return buildConfig.locales.includes( fallbackLocale );
+        return buildConfig.allLocales.includes( fallbackLocale );
       } ) ) {
         includedDataLocales.push( locale );
       }
jonathanolson commented 1 week ago

Deploys are going out. I'll check this later or tomorrow.

jonathanolson commented 1 week ago

Deploys should be complete. @DianaTavares can you verify?

DianaTavares commented 1 week ago

I'm still going to the PhET website ins Spanish and the sim open in English:

image

that happen in my cellphone and computer, do I need to do something special?

zepumph commented 1 week ago

I believe this will be cached until tomorrow.

mattpen commented 1 week ago

I checked and the uncached copy is showing the same thing.

To see an uncached copy, change the subdomain to phet-origin and add a random query parameter (e.g. nonce=something)

https://phet-origin.colorado.edu/sims/html/build-an-atom/latest/build-an-atom_all.html?locales=es&nonce=4398ty3489

zepumph commented 1 week ago

Thanks for the reminder @mattpen, I always forget. I believe the test is locale=es, singular. When I do that everything is working well!

https://phet-origin.colorado.edu/sims/html/build-an-atom/latest/build-an-atom_all.html?locale=es&nonce=4398ty3489fds

@DianaTavares can you confirm.

DianaTavares commented 1 week ago

It is working!! Can I close this issue?

zepumph commented 1 week ago

Thanks so much @jonathanolson and @mattpen for the quick work here.