Skip to content

Commit

Permalink
organize friction a11y strings with nested objects, #180
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 22, 2019
1 parent 0069488 commit 9250e3e
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 130 deletions.
196 changes: 103 additions & 93 deletions friction-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"value": "Move slower"
},
"a11y": {

"chemistryBook": {
"value": "Chemistry book"
},
Expand All @@ -40,159 +39,171 @@
"moveInSmallerStepsWith": {
"value": "Move slower with Shift plus Arrow keys, or Shift plus letter keys W, A, S, or D."
},

"initialGrabbedNotTouching": {
"value": "Grabbed. Lightly on Physics book. Move book with W, A, S, or D key. Space to release."
},

"grabbedNotTouching": {
"value": "Grabbed. Lightly on Physics book. Move down to rub harder."
},

"initialGrabbedTouching": {
"value": "Grabbed. Rub fast or slow with A or D keys. Space to release."
},

"grabbedTouching": {
"value": "Grabbed. Rub fast or slow."
},


"amountOfAtoms": {
"value": "Chemistry book has {{comparisonAmount}} jiggling atoms as {{breakAwayAmount}} have broken away. "
},
"fewer": {
"value": "fewer"
},
"farFewer": {
"value": "far fewer"
},
"some": {
"value": "some"
},
"many": {
"value": "many"
},


"jiggleALot": {
"value": "jiggle a lot"
},

"jiggleALittle": {
"value": "jiggle a little"
},

"jiggleABit": {
"value": "jiggle a tiny bit"
},

"slowingDown": {
"value": "slowing down"
},

"superHot": { "value": "super hot" },
"veryHot": { "value": "very hot" },
"hot": { "value": "hot" },
"atWarm": { "value": "warm" },
"atCool": { "value": "cool" },

"temperaturePattern": {
"value": "surface temperature {{thermometer}}is {{temp}}"
"sentence": {
"value": "Chemistry book has {{comparisonAmount}} jiggling atoms as {{breakAwayAmount}} have broken away. "
},
"fewer": {
"value": "fewer"
},
"farFewer": {
"value": "far fewer"
},
"some": {
"value": "some"
},
"many": {
"value": "many"
}
},
"jiggle": {
"aLot": {
"value": "jiggle a lot"
},
"aLittle": {
"value": "jiggle a little"
},
"aBit": {
"value": "jiggle a tiny bit"
}
},
"temperature": {
"superHot": {
"value": "super hot"
},
"veryHot": {
"value": "very hot"
},
"hot": {
"value": "hot"
},
"atWarm": {
"value": "warm"
},
"atCool": {
"value": "cool"
},
"statePattern": {
"value": "surface temperature {{thermometer}}is {{temp}}"
},
"cooler": {
"value": "cooler"
},
"nowCooler": {
"value": "now cooler"
},
"warmer": {
"value": "warmer"
},
"nowWarm": {
"value": "now warm"
},
"evenHotter": {
"value": "even hotter"
},
"evenCooler": {
"value": "even cooler"
},
"nowHot": {
"value": "now hot"
},
"nowHotter": {
"value": "now hotter"
},
"dropping": {
"value": "dropping"
}
},
"thermometer": {
"value": "thermometer "
},

"temperatureDropping": {
"value": "temperature dropping"
},

"droppingAsAtomsJiggleLess": {
"value": "dropping as atoms jiggle less"
},

"atomsJigglePattern": {
"value": "atoms {{jiggleAmount}}"
},

"jiggleClausePattern": {
"value": "and {{jiggleAmount}}"
},

"jiggleTemperatureScaleSentence": {
"value": "In zoomed-in view of where books meet, {{temperatureClause}}, {{jigglingClause}}."
},


"moveChemistryBookSentence": {
"value": "Grab Chemistry book to play."
},

"moveDownToRubHarderSentence": {
"value": "Move down to rub harder."
},


"positionMoveDownPattern": {
"value": "{{position}}. {{moveDownToRubHarder}}"
},

"downRubFastOrSlow": {
"value": "Down. Rub fast or slow."
},

"resetSimMoreObservationSentence": {
"value": "Reset sim to make more observations."
},

"startingChemistryBookPattern": {
"value": "{{relativeChemistryBookSentence}}Chemistry book rests {{lightly}}on top of a Physics book, and is ready to be rubbed against it."
},

"lightly": {
"value": "lighty "
},

"summarySentencePattern": {
"value": "{{chemistryBookString}} {{jiggleTemperatureScaleSentence}}"
},

"atomsJiggleTinyBitTempCool": {
"value": "Atoms jiggle a tiny bit, temperature cool"
},

"aTinyBit": { "value": "a tiny bit" },
"aLittle": { "value": "a little" },
"aLittleMore": { "value": "a little more" },
"more": { "value": "more" },
"faster": { "value": "faster" },
"evenFaster": { "value": "even faster" },
"superFast": { "value": "super fast" },

"less": { "value": "less" },
"evenLess": { "value": "even less" },
"evenCooler": { "value": "even cooler" },

"cooler": { "value": "cooler" },
"jigglingLess": { "value": "jiggling less" },
"nowCooler": { "value": "now cooler" },
"warmer": { "value": "warmer" },
"nowWarm": { "value": "now warm" },
"evenHotter": { "value": "even hotter" },
"nowHot": { "value": "now hot" },
"nowHotter": { "value": "now hotter" },

"dropping": { "value": "dropping" },

"aTinyBit": {
"value": "a tiny bit"
},
"aLittle": {
"value": "a little"
},
"aLittleMore": {
"value": "a little more"
},
"more": {
"value": "more"
},
"faster": {
"value": "faster"
},
"evenFaster": {
"value": "even faster"
},
"superFast": {
"value": "super fast"
},
"less": {
"value": "less"
},
"evenLess": {
"value": "even less"
},
"jigglingLess": {
"value": "jiggling less"
},
"frictionIncreasingAtomsJigglingTemperaturePattern": {
"value": "Jiggling {{jigglingAmount}}, {{temperature}}"
},

"frictionIncreasingAtomsJigglingTemperatureFirstPattern": {
"value": "Atoms {{jigglingAmount}}, temperature {{temperature}}"
},

"capitalizedVeryHot": {
"value": "Very Hot"
},
Expand All @@ -211,6 +222,5 @@
"breakAwayNoneLeft": {
"value": "{{temp}}. Atoms jiggling very fast."
}

}
}
18 changes: 9 additions & 9 deletions js/friction/FrictionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ define( function( require ) {
];

// a11y strings
const jiggleALotString = require( 'string!FRICTION/a11y.jiggleALot' );
const jiggleALittleString = require( 'string!FRICTION/a11y.jiggleALittle' );
const jiggleABitString = require( 'string!FRICTION/a11y.jiggleABit' );
const veryHotString = require( 'string!FRICTION/a11y.veryHot' );
const hotString = require( 'string!FRICTION/a11y.hot' );
const atWarmString = require( 'string!FRICTION/a11y.atWarm' );
const atCoolString = require( 'string!FRICTION/a11y.atCool' );
const jiggleALotString = require( 'string!FRICTION/a11y.jiggle.aLot' );
const jiggleALittleString = require( 'string!FRICTION/a11y.jiggle.aLittle' );
const jiggleABitString = require( 'string!FRICTION/a11y.jiggle.aBit' );
const temperatureVeryHotString = require( 'string!FRICTION/a11y.temperature.veryHot' );
const temperatureHotString = require( 'string!FRICTION/a11y.temperature.hot' );
const temperatureAtWarmString = require( 'string!FRICTION/a11y.temperature.atWarm' );
const temperatureAtCoolString = require( 'string!FRICTION/a11y.temperature.atCool' );

const FrictionConstants = {
TOP_BOOK_COLOR_MACRO: new Color( 'rgb(125,226,249)' ), // color of the macroscopic view of the book
Expand All @@ -48,8 +48,8 @@ define( function( require ) {

// a11y - the mappings work well divided into 9 sections (arbitrary, but @terracoda's design diagram fit into 9 well
// These are only used for the screen summary description in the PDOM, not alerts
TEMPERATURE_STRINGS: [ atCoolString, atCoolString, atWarmString, atWarmString, atWarmString, hotString, hotString,
hotString, veryHotString ],
TEMPERATURE_STRINGS: [ temperatureAtCoolString, temperatureAtCoolString, temperatureAtWarmString, temperatureAtWarmString, temperatureAtWarmString, temperatureHotString, temperatureHotString,
temperatureHotString, temperatureVeryHotString ],
JIGGLE_STRINGS: [ jiggleABitString, jiggleABitString, jiggleALittleString, jiggleALittleString, jiggleALittleString,
jiggleALotString, jiggleALotString, jiggleALotString, jiggleALotString ]
};
Expand Down
26 changes: 13 additions & 13 deletions js/friction/view/FrictionScreenSummaryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ define( require => {
const jiggleClausePatternString = require( 'string!FRICTION/a11y.jiggleClausePattern' );
const jiggleTemperatureScaleSentenceString = require( 'string!FRICTION/a11y.jiggleTemperatureScaleSentence' );
const thermometerString = require( 'string!FRICTION/a11y.thermometer' );
const temperaturePatternString = require( 'string!FRICTION/a11y.temperaturePattern' );
const temperatureStatePatternString = require( 'string!FRICTION/a11y.temperature.statePattern' );
const moveChemistryBookSentenceString = require( 'string!FRICTION/a11y.moveChemistryBookSentence' );
const resetSimMoreObservationSentenceString = require( 'string!FRICTION/a11y.resetSimMoreObservationSentence' );
const startingChemistryBookPatternString = require( 'string!FRICTION/a11y.startingChemistryBookPattern' );
const lightlyString = require( 'string!FRICTION/a11y.lightly' );
const amountOfAtomsString = require( 'string!FRICTION/a11y.amountOfAtoms' );
const fewerString = require( 'string!FRICTION/a11y.fewer' );
const farFewerString = require( 'string!FRICTION/a11y.farFewer' );
const someString = require( 'string!FRICTION/a11y.some' );
const manyString = require( 'string!FRICTION/a11y.many' );
const amountOfAtomsSentenceString = require( 'string!FRICTION/a11y.amountOfAtoms.sentence' );
const amountOfAtomsFewerString = require( 'string!FRICTION/a11y.amountOfAtoms.fewer' );
const amountOfAtomsFarFewerString = require( 'string!FRICTION/a11y.amountOfAtoms.farFewer' );
const amountOfAtomsSomeString = require( 'string!FRICTION/a11y.amountOfAtoms.some' );
const amountOfAtomsManyString = require( 'string!FRICTION/a11y.amountOfAtoms.many' );

// Used for the screen summary sentence to compare how many atoms have evaporated
const SOME_ATOMS_EVAPORATED_THRESHOLD = FrictionModel.NUMBER_OF_EVAPORABLE_ATOMS / 2;
Expand Down Expand Up @@ -115,17 +115,17 @@ define( require => {

// some evaporated atoms, describe the chemistry book with some atoms "broken away"
else if ( atomsEvaporated < SOME_ATOMS_EVAPORATED_THRESHOLD ) {
relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsString, {
comparisonAmount: fewerString,
breakAwayAmount: someString
relativeChemistryBookSentence = StringUtils.fillIn( amountOfAtomsSentenceString, {
comparisonAmount: amountOfAtomsFewerString,
breakAwayAmount: amountOfAtomsSomeString
} );
}

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

Expand Down Expand Up @@ -212,7 +212,7 @@ define( require => {
}

// Fill in the current temperature string
const tempString = StringUtils.fillIn( temperaturePatternString, {
const tempString = StringUtils.fillIn( temperatureStatePatternString, {
temp: this.amplitudeToTempString( vibrationAmplitudeProperty.value ),
thermometer: inTransition ? '' : thermometerString
} );
Expand Down
Loading

0 comments on commit 9250e3e

Please sign in to comment.