Skip to content

Commit

Permalink
use {{space}} as a template var for trailing or leading spaces so tha…
Browse files Browse the repository at this point in the history
…t it isn't trimmed, #237
  • Loading branch information
zepumph committed Sep 22, 2021
1 parent 84d3aad commit b62a8d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions friction-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -120,7 +120,7 @@
"value": "surface temperature {{thermometer}}is {{temp}}"
},
"thermometer": {
"value": "thermometer "
"value": "thermometer{{space}}"
},
"more": {
"value": "more"
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 6 additions & 4 deletions js/friction/view/FrictionScreenSummaryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -115,15 +115,17 @@ class FrictionScreenSummaryNode extends Node {
else if ( atomsEvaporated < SOME_ATOMS_EVAPORATED_THRESHOLD ) {
relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsString, {
comparisonAmount: fewerString,
breakAwayAmount: someString
breakAwayAmount: someString,
space: ' '
} );
}

// lots of evaporated atoms, describe many missing atoms
else {
relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsString, {
comparisonAmount: farFewerString,
breakAwayAmount: manyString
breakAwayAmount: manyString,
space: ' '
} );
}

Expand Down

0 comments on commit b62a8d8

Please sign in to comment.