From b62a8d8d6b6d5deeea75b91292352af7b29fccbf Mon Sep 17 00:00:00 2001 From: zepumph Date: Wed, 22 Sep 2021 10:47:46 -0600 Subject: [PATCH] use {{space}} as a template var for trailing or leading spaces so that it isn't trimmed, https://github.com/phetsims/friction/issues/237 --- friction-strings_en.json | 6 +++--- js/friction/view/FrictionScreenSummaryNode.js | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/friction-strings_en.json b/friction-strings_en.json index ca2eac19..120ef939 100644 --- a/friction-strings_en.json +++ b/friction-strings_en.json @@ -62,7 +62,7 @@ }, "amountOfAtoms": { "sentence": { - "value": "Chemistry book has {{comparisonAmount}} jiggling atoms as {{breakAwayAmount}} have broken away. " + "value": "Chemistry book has {{comparisonAmount}} jiggling atoms as {{breakAwayAmount}} have broken away.{{space}}" }, "fewer": { "value": "fewer" @@ -120,7 +120,7 @@ "value": "surface temperature {{thermometer}}is {{temp}}" }, "thermometer": { - "value": "thermometer " + "value": "thermometer{{space}}" }, "more": { "value": "more" @@ -201,7 +201,7 @@ "value": "Reset sim to make more observations." }, "lightly": { - "value": "lightly " + "value": "lightly{{space}}" }, "atomsJiggleTinyBitTempCool": { "value": "Atoms jiggle a tiny bit, temperature cool" diff --git a/js/friction/view/FrictionScreenSummaryNode.js b/js/friction/view/FrictionScreenSummaryNode.js index 3c8e928c..97d832c3 100644 --- a/js/friction/view/FrictionScreenSummaryNode.js +++ b/js/friction/view/FrictionScreenSummaryNode.js @@ -18,12 +18,12 @@ const droppingAsAtomsJiggleLessString = frictionStrings.a11y.screenSummary.dropp const atomsJigglePatternString = frictionStrings.a11y.screenSummary.atomsJigglePattern; const jiggleClausePatternString = frictionStrings.a11y.screenSummary.jiggleClausePattern; const jiggleTemperatureScaleSentenceString = frictionStrings.a11y.screenSummary.jiggleTemperatureScaleSentence; -const thermometerString = frictionStrings.a11y.temperature.thermometer; +const thermometerString = StringUtils.fillIn( frictionStrings.a11y.temperature.thermometer, { space: ' ' } ); const temperaturePatternString = frictionStrings.a11y.temperature.pattern; const grabChemistryBookPlayString = frictionStrings.a11y.screenSummary.grabChemistryBookPlay; const resetSimMoreObservationSentenceString = frictionStrings.a11y.resetSimMoreObservationSentence; const startingChemistryBookPatternString = frictionStrings.a11y.screenSummary.startingChemistryBookPattern; -const lightlyString = frictionStrings.a11y.lightly; +const lightlyString = StringUtils.fillIn( frictionStrings.a11y.lightly, { space: ' ' } ); const amountOfAtomsString = frictionStrings.a11y.amountOfAtoms.sentence; const fewerString = frictionStrings.a11y.amountOfAtoms.fewer; const farFewerString = frictionStrings.a11y.amountOfAtoms.farFewer; @@ -115,7 +115,8 @@ class FrictionScreenSummaryNode extends Node { else if ( atomsEvaporated < SOME_ATOMS_EVAPORATED_THRESHOLD ) { relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsString, { comparisonAmount: fewerString, - breakAwayAmount: someString + breakAwayAmount: someString, + space: ' ' } ); } @@ -123,7 +124,8 @@ class FrictionScreenSummaryNode extends Node { else { relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsString, { comparisonAmount: farFewerString, - breakAwayAmount: manyString + breakAwayAmount: manyString, + space: ' ' } ); }