Closed liammulh closed 1 year ago
As of https://github.com/phetsims/rosetta/commit/85f046cb279884f1693907d03239b59b8c92806c the translation utility seems to show shared strings for Concentration, but not for Geometric Optics.
The shared strings object in the translation form data was empty on the Geometric Optics translation form page. I need to check and see if categorizedStringKeys.shared
is empty for Geometric Optics.
Okay, I've verified that categorizedStringKeys.shared
and categorizedStringKeys.sharedSims
are both empty for Geometric Optics in Abkhazian (ab) using the master phetsims/babel branch.
Why? Is the logic for adding them incorrect? I will compare the logic of the old translation utility and the new one. It might be that the old one is determining whether it has shared strings based on sim key in the sim metadata. If so, we could just key into the sim metadata for the given sim, I think.
I think this might actually be fixed. Geometric Optics: Basics is the sim that has the shared strings.
I need to go through a handful of sims and ensure this is working properly. For the next round of testing, QA should go through the sims on the old translation util, and for each sim with shared strings, they should verify that the new translation util also shows shared strings.
I believe this is fixed. We will need to test this before publication.
For future reference, the fix for this issue was in https://github.com/phetsims/rosetta/commit/85f046cb279884f1693907d03239b59b8c92806c. The issue was that if there wasn't a translated file for a sim, the shared English value and the shared translated value weren't being set. Of course, when there is no translated file, the translated value needs to be an empty string.
Bumper and Under Pressure both have shared strings on the main website but not on ox-dev
Bumper and Under Pressure both have shared strings on the main website but not on ox-dev
Based on the above, it looks like Bumper should share strings with Chains. I looked at Bumper on Ox-Dev, and it would seem at least some of the shared strings are ending up in the common table. Are all shared strings in the common table?
Based on the above, it looks like Under Pressure should share strings with Fluid Pressure and Flow.
I need to look at getCategorizedStrings.js
.
Are all shared strings in the common table (for Bumper)?
"CHAINS/htmlString": "Turning left on <i>red</i> is a <b>bold</b> move.",
"CHAINS/multilineString": "Give me a\nbreak.",
"CHAINS/namedPlaceholdersString": "{{name}} is traveling at {{speed}} km/hr",
"CHAINS/patternString": "{0}: {1} {2}",
"CHAINS/plainString": "It's not easy being green.",
"CHAINS/size": "Size",
Are all shared strings in the common table (for Under Pressure)?
"FLUID_PRESSURE_AND_FLOW/atm": "atm",
"FLUID_PRESSURE_AND_FLOW/psi": "psi",
"FLUID_PRESSURE_AND_FLOW/kPa": "kPa",
"FLUID_PRESSURE_AND_FLOW/valueWithUnitsPattern": "{0} {1}",
"FLUID_PRESSURE_AND_FLOW/ftPerSPerS": "ft/s<sup>2</sup>",
"FLUID_PRESSURE_AND_FLOW/mPerSPerS": "m/s<sup>2</sup>",
"FLUID_PRESSURE_AND_FLOW/densityUnitsEnglish": "lb/ft<sup>3</sup>",
"FLUID_PRESSURE_AND_FLOW/densityUnitsMetric": "kg/m<sup>3</sup>",
"FLUID_PRESSURE_AND_FLOW/m": "m",
"FLUID_PRESSURE_AND_FLOW/ft": "ft",
"FLUID_PRESSURE_AND_FLOW/atmosphere": "Atmosphere",
"FLUID_PRESSURE_AND_FLOW/on": "On",
"FLUID_PRESSURE_AND_FLOW/off": "Off",
"FLUID_PRESSURE_AND_FLOW/grid": "Grid",
"FLUID_PRESSURE_AND_FLOW/ruler": "Ruler",
"FLUID_PRESSURE_AND_FLOW/metric": "Metric",
"FLUID_PRESSURE_AND_FLOW/english": "English",
"FLUID_PRESSURE_AND_FLOW/units": "Units",
"FLUID_PRESSURE_AND_FLOW/atmospheres": "Atmospheres",
"FLUID_PRESSURE_AND_FLOW/pressure": "Pressure",
"FLUID_PRESSURE_AND_FLOW/readoutMeters": "{0} m",
"FLUID_PRESSURE_AND_FLOW/readoutFeet": "{0} ft",
"FLUID_PRESSURE_AND_FLOW/massLabelPattern": "{0} kg",
"FLUID_PRESSURE_AND_FLOW/mysteryFluid": "Mystery Fluid",
"FLUID_PRESSURE_AND_FLOW/mysteryPlanet": "Mystery Planet",
"FLUID_PRESSURE_AND_FLOW/planetA": "Planet A",
"FLUID_PRESSURE_AND_FLOW/planetB": "Planet B",
"FLUID_PRESSURE_AND_FLOW/planetC": "Planet C",
"FLUID_PRESSURE_AND_FLOW/fluidA": "Fluid A",
"FLUID_PRESSURE_AND_FLOW/fluidB": "Fluid B",
"FLUID_PRESSURE_AND_FLOW/fluidC": "Fluid C",
"FLUID_PRESSURE_AND_FLOW/fluidDensity": "Fluid Density",
"FLUID_PRESSURE_AND_FLOW/gravity": "Gravity",
"FLUID_PRESSURE_AND_FLOW/earth": "Earth",
"FLUID_PRESSURE_AND_FLOW/mars": "Mars",
"FLUID_PRESSURE_AND_FLOW/jupiter": "Jupiter",
"FLUID_PRESSURE_AND_FLOW/gasoline": "gasoline",
"FLUID_PRESSURE_AND_FLOW/water": "water",
"FLUID_PRESSURE_AND_FLOW/honey": "honey",
"FLUID_PRESSURE_AND_FLOW/underPressureScreenTitle": "Under Pressure",
Based on the above investigation, I think it's reasonable to assume that somehow the strings that should be shared strings are being categorized as common strings. How are these strings being categorized as common rather than shared?
Here's the relevant code in getCategorizedStringKeys.js
:
if ( repoName === simName ) {
logger.verbose( `categorizing sim-specific string key: ${stringKeyWithRepoName}` );
categorizedStringKeys.simSpecific.push( stringKey );
}
else if ( simNames.includes( repoName ) ) {
logger.verbose( `categorizing shared string key: ${stringKeyWithRepoName}` );
categorizedStringKeys.shared.push( stringKey );
if ( !categorizedStringKeys.sharedSims.includes( repoName ) ) {
categorizedStringKeys.sharedSims.push( repoName );
}
}
else {
logger.verbose( `categorizing common string key: ${stringKeyWithRepoName}` );
categorizedStringKeys.common.push( stringKey );
}
Neither Chains nor Fluid Pressure and Flow are in the list of sims being passed to getCategorizedStringKeys.js
:
simNames
(list of sims)Neither Bumper nor Fluid Pressure and Flow are in the list of sims being passed to
getCategorizedStringKeys.js
.
This is because they are not supposed to be in the list of sims if you aren't a team member.
The way this is happening is:
It wouldn't be very DRY, but we could sort of replicate the code for getting sim names and titles in getCategorizedStringKeys.js
, but instead of checking for whether the person is a team member, just get the full list of sims, even the invisible ones. I don't know if this would cause other problems. I'll have to think about what the best solution to this would be.
Maybe we do something like:
const simMetadata = await getSimMetadata();
const simNames = Object.keys( getSimNamesAndTitles( simMetadata, 'true' ) );
It's okay for Under Pressure's shared strings to be in the common category.
@jbphet and I reviewed this. The strings for FPAF in Under Pressure will be categorized as common strings since that is the "fallback" category if they can't be categorized as shared strings. To be categorized as a shared string, the string's repo needs to be in the list of all sims, and FPAF is never in that list, thus it falls into the common category.
Things look good in Under Pressure and two random sims. Bumper couldn't be tested since sign ins don't work right now, so leaving open.
looks good on bumper as well as various other sims 👍
In https://github.com/phetsims/qa/issues/869, we discovered that a sim with shared strings won't have a shared strings table. I looked at the code, and I think we need to check if there's a translated file, and if there isn't we should set the shared string to be an empty string.