Skip to content

Commit

Permalink
reorganize a11y strings into nested structure, remove comments, #205
Browse files Browse the repository at this point in the history
(cherry picked from commit fbde0f1)
  • Loading branch information
zepumph committed Dec 30, 2019
1 parent 98c2bce commit 8d1a761
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 191 deletions.
2 changes: 1 addition & 1 deletion js/molarity/view/BeakerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ define( require => {
const unitsLitersString = require( 'string!MOLARITY/units.liters' );

// a11y strings
const beakerHeaderString = require( 'string!MOLARITY/a11y.beakerHeader' );
const beakerHeaderString = require( 'string!MOLARITY/a11y.beaker.header' );

// constants
const DEBUG_SHAPES = false;
Expand Down
16 changes: 8 additions & 8 deletions js/molarity/view/MolarityBeakerDescriptionNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ define( require => {
const drinkMixString = require( 'string!MOLARITY/drinkMix' );

// a11y strings
const beakerDescriptionPatternString = require( 'string!MOLARITY/a11y.beakerDescriptionPattern' );
const hasZeroConcentrationString = require( 'string!MOLARITY/a11y.hasZeroConcentration' );
const beakerDescriptionPureWaterPatternString = require( 'string!MOLARITY/a11y.beakerDescriptionPureWaterPattern' );
const pureWaterString = require( 'string!MOLARITY/a11y.pureWater' );
const waterFormulaDescriptionString = require( 'string!MOLARITY/a11y.waterFormulaDescription' );
const beakerDescriptionPatternString = require( 'string!MOLARITY/a11y.beaker.descriptionPattern' );
const beakerHasZeroConcentrationString = require( 'string!MOLARITY/a11y.beaker.hasZeroConcentration' );
const beakerDescriptionPureWaterPatternString = require( 'string!MOLARITY/a11y.beaker.descriptionPureWaterPattern' );
const beakerPureWaterString = require( 'string!MOLARITY/a11y.beaker.pureWater' );
const beakerWaterFormulaDescriptionString = require( 'string!MOLARITY/a11y.beaker.waterFormulaDescription' );

class MolarityBeakerDescriptionNode extends Node {

Expand Down Expand Up @@ -105,7 +105,7 @@ define( require => {
updateBeakerSummaryString() {
const summaryString = !this.solution.hasSolute() ? beakerDescriptionPureWaterPatternString : beakerDescriptionPatternString;
return StringUtils.fillIn( summaryString, {
solute: !this.solution.hasSolute() ? pureWaterString : this.soluteDescriber.getCurrentSoluteName(),
solute: !this.solution.hasSolute() ? beakerPureWaterString : this.soluteDescriber.getCurrentSoluteName(),
volume: this.volumeDescriber.getCurrentVolume( true ),
color: this.soluteDescriber.getCurrentColor()
} );
Expand Down Expand Up @@ -135,7 +135,7 @@ define( require => {
*/
updateConcentrationSummary() {
if ( !this.solution.hasSolute() ) {
this.concentrationSummaryItem.innerContent = hasZeroConcentrationString;
this.concentrationSummaryItem.innerContent = beakerHasZeroConcentrationString;
}
else {
this.concentrationSummaryItem.innerContent = this.concentrationDescriber.getBeakerConcentrationString(
Expand All @@ -153,7 +153,7 @@ define( require => {
if ( !this.solution.hasSolute() ) {

// if there is no solute in the beaker, the chemical formula of water is displayed instead.
this.chemicalFormulaSummaryItem.innerContent = ChemUtils.toSubscript( waterFormulaDescriptionString );
this.chemicalFormulaSummaryItem.innerContent = ChemUtils.toSubscript( beakerWaterFormulaDescriptionString );
this.chemicalFormulaSummaryContainer.children = [ this.chemicalFormulaSummaryItem ];

}
Expand Down
16 changes: 8 additions & 8 deletions js/molarity/view/MolarityKeyboardHelpContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ define( require => {

// a11y strings
// Description strings for list of help commands
const popUpListDescriptionString = require( 'string!MOLARITY/a11y.popUpListDescription' );
const moveThroughDescriptionString = require( 'string!MOLARITY/a11y.moveThroughDescription' );
const changeChooseDescriptionString = require( 'string!MOLARITY/a11y.changeChooseDescription' );
const closeListDescriptionString = require( 'string!MOLARITY/a11y.closeListDescription' );
const helpContentPopUpListDescriptionString = require( 'string!MOLARITY/a11y.helpContent.popUpListDescription' );
const helpContentMoveThroughDescriptionString = require( 'string!MOLARITY/a11y.helpContent.moveThroughDescription' );
const helpContentChangeChooseDescriptionString = require( 'string!MOLARITY/a11y.helpContent.changeChooseDescription' );
const helpContentCloseListDescriptionString = require( 'string!MOLARITY/a11y.helpContent.closeListDescription' );

// constants
const labelWithIcon = KeyboardHelpSection.labelWithIcon;
Expand All @@ -44,10 +44,10 @@ define( require => {
const sliderKeyboardHelpSection = new SliderKeyboardHelpSection( { headingString: keyboardSliderHelpHeadingString } );

// change solute help section
const step1 = labelWithIcon( keyboardPopUpListString, KeyboardHelpIconFactory.enterOrSpace(), popUpListDescriptionString );
const step2 = labelWithIcon( keyboardMoveThroughString, KeyboardHelpIconFactory.upOrDown(), moveThroughDescriptionString );
const step3 = labelWithIcon( keyboardChangeSoluteString, KeyboardHelpIconFactory.enter(), changeChooseDescriptionString );
const step4 = labelWithIcon( keyboardCloseListString, KeyboardHelpIconFactory.esc(), closeListDescriptionString );
const step1 = labelWithIcon( keyboardPopUpListString, KeyboardHelpIconFactory.enterOrSpace(), helpContentPopUpListDescriptionString );
const step2 = labelWithIcon( keyboardMoveThroughString, KeyboardHelpIconFactory.upOrDown(), helpContentMoveThroughDescriptionString );
const step3 = labelWithIcon( keyboardChangeSoluteString, KeyboardHelpIconFactory.enter(), helpContentChangeChooseDescriptionString );
const step4 = labelWithIcon( keyboardCloseListString, KeyboardHelpIconFactory.esc(), helpContentCloseListDescriptionString );
const changeSoluteContent = [ step1, step2, step3, step4 ];
const changeSoluteHelpSection = new KeyboardHelpSection( keyboardChangeSoluteHelpHeadingString, changeSoluteContent, {
a11yContentTagName: 'ol'
Expand Down
20 changes: 10 additions & 10 deletions js/molarity/view/MolarityScreenSummaryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ define( require => {
// a11y strings
const ofString = require( 'string!MOLARITY/a11y.of' );
const notSaturatedString = require( 'string!MOLARITY/a11y.notSaturated' );
const screenSummaryQualitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.screenSummaryQualitativeConcentrationPattern' );
const screenSummaryQuantitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.screenSummaryQuantitativeConcentrationPattern' );
const screenSummaryQualitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.screenSummary.qualitativeConcentrationPattern' );
const screenSummaryQuantitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.screenSummary.quantitativeConcentrationPattern' );
const saturatedString = require( 'string!MOLARITY/a11y.saturated' );
const screenSummaryPlayAreaPatternString = require( 'string!MOLARITY/a11y.screenSummaryPlayAreaPattern' );
const screenSummaryControlAreaPatternString = require( 'string!MOLARITY/a11y.screenSummaryControlAreaPattern' );
const simInteractionHintString = require( 'string!MOLARITY/a11y.simInteractionHint' );
const currentStateOfSimNoSolutePatternString = require( 'string!MOLARITY/a11y.currentStateOfSimNoSolutePattern' );
const currentStateOfSimPatternString = require( 'string!MOLARITY/a11y.currentStateOfSimPattern' );
const screenSummaryPlayAreaPatternString = require( 'string!MOLARITY/a11y.screenSummary.playAreaPattern' );
const screenSummaryControlAreaPatternString = require( 'string!MOLARITY/a11y.screenSummary.controlAreaPattern' );
const screenSummarySimInteractionHintString = require( 'string!MOLARITY/a11y.screenSummary.simInteractionHint' );
const screenSummaryCurrentStateOfSimNoSolutePatternString = require( 'string!MOLARITY/a11y.screenSummary.currentStateOfSimNoSolutePattern' );
const screenSummaryCurrentStateOfSimPatternString = require( 'string!MOLARITY/a11y.screenSummary.currentStateOfSimPattern' );

class MolarityScreenSummaryNode extends Node {

Expand Down Expand Up @@ -72,7 +72,7 @@ define( require => {
// Fourth paragraph of the screen summary -- static regardless of state of sim, gives the interaction hint
this.addChild( new Node( {
tagName: 'p',
innerContent: simInteractionHintString
innerContent: screenSummarySimInteractionHintString
} ) );

// Updates the third paragraph of the screen summary when sim Properties change.
Expand All @@ -93,7 +93,7 @@ define( require => {
* descriptions are show, and whether or not there is some solute in the beaker.
*/
getStateOfSimDescription() {
let stateString = currentStateOfSimPatternString;
let stateString = screenSummaryCurrentStateOfSimPatternString;

// concentrationString will form the base of the concentrationPattern substring (filled in below)
const concentrationString = this.useQuantitativeDescriptionsProperty.value ?
Expand All @@ -106,7 +106,7 @@ define( require => {

// If there is no solute in the beaker, the PDOM descriptions change.
if ( !this.solution.hasSolute() ) {
stateString = currentStateOfSimNoSolutePatternString;
stateString = screenSummaryCurrentStateOfSimNoSolutePatternString;
}

return StringUtils.fillIn( stateString, {
Expand Down
24 changes: 12 additions & 12 deletions js/molarity/view/describers/ConcentrationDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ define( require => {
const StringUtils = require( 'PHETCOMMON/util/StringUtils' );

// a11y strings
const colorChangePatternString = require( 'string!MOLARITY/a11y.colorChangePattern' );
const concentrationAndUnitString = require( 'string!MOLARITY/a11y.concentrationAndUnit' );
const concentrationChangePatternString = require( 'string!MOLARITY/a11y.concentrationChangePattern' );
const beakerConcentrationRangePatternString = require( 'string!MOLARITY/a11y.beakerConcentrationRangePattern' );
const qualitativeConcentrationStateClausePatternString = require( 'string!MOLARITY/a11y.qualitativeConcentrationStateClausePattern' );
const quantitativeConcentrationStatePatternString = require( 'string!MOLARITY/a11y.quantitativeConcentrationStatePattern' );
const quantityChangeColorChangePatternString = require( 'string!MOLARITY/a11y.quantityChange.colorChangePattern' );
const quantitativeConcentrationAndUnitString = require( 'string!MOLARITY/a11y.quantitative.concentrationAndUnit' );
const quantityChangeConcentrationChangePatternString = require( 'string!MOLARITY/a11y.quantityChange.concentrationChangePattern' );
const beakerConcentrationRangePatternString = require( 'string!MOLARITY/a11y.beaker.concentrationRangePattern' );
const qualitativeConcentrationStateClausePatternString = require( 'string!MOLARITY/a11y.qualitative.concentrationStateClausePattern' );
const quantitativeConcentrationStatePatternString = require( 'string!MOLARITY/a11y.quantitative.concentrationStatePattern' );

// Concentration region strings
const concentrationRegionsPassiveZeroConcentrationString = require( 'string!MOLARITY/a11y.concentrationRegions.passive.zeroConcentration' );
Expand All @@ -47,8 +47,8 @@ define( require => {
const lessLowercaseString = require( 'string!MOLARITY/a11y.less.lowercase' );
const moreCapitalizedString = require( 'string!MOLARITY/a11y.more.capitalized' );
const moreLowercaseString = require( 'string!MOLARITY/a11y.more.lowercase' );
const lighterString = require( 'string!MOLARITY/a11y.lighter' );
const darkerString = require( 'string!MOLARITY/a11y.darker' );
const quantityChangeLighterString = require( 'string!MOLARITY/a11y.quantityChange.lighter' );
const quantityChangeDarkerString = require( 'string!MOLARITY/a11y.quantityChange.darker' );

// constants
const ACTIVE_CONCENTRATION_STRINGS = [
Expand Down Expand Up @@ -154,7 +154,7 @@ define( require => {
getCurrentConcentrationClause( isPassive = false ) {
const concentration = this.concentrationProperty.value;
if ( this.useQuantitativeDescriptionsProperty.value ) {
return StringUtils.fillIn( concentrationAndUnitString, {
return StringUtils.fillIn( quantitativeConcentrationAndUnitString, {
concentration: Util.toFixed( concentration, MolarityConstants.CONCENTRATION_DECIMAL_PLACES )
} );
}
Expand Down Expand Up @@ -220,7 +220,7 @@ define( require => {
if ( this.concentrationIncreased ) {
moreLessString = isCapitalized ? moreCapitalizedString : moreLowercaseString;
}
return StringUtils.fillIn( concentrationChangePatternString, {
return StringUtils.fillIn( quantityChangeConcentrationChangePatternString, {
moreLess: moreLessString
} );
}
Expand All @@ -233,8 +233,8 @@ define( require => {
getColorChangeString() {
assert && assert( !this.solution.isSaturated(), 'color cannot change when saturated' );

return StringUtils.fillIn( colorChangePatternString, {
lighterDarker: this.concentrationIncreased ? darkerString : lighterString
return StringUtils.fillIn( quantityChangeColorChangePatternString, {
lighterDarker: this.concentrationIncreased ? quantityChangeDarkerString : quantityChangeLighterString
} );
}

Expand Down
2 changes: 1 addition & 1 deletion js/molarity/view/describers/PrecipitateAmountDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define( require => {

// a11y strings
const atMaxConcentrationPatternString = require( 'string!MOLARITY/a11y.atMaxConcentrationPattern' );
const beakerSaturationPatternString = require( 'string!MOLARITY/a11y.beakerSaturationPattern' );
const beakerSaturationPatternString = require( 'string!MOLARITY/a11y.beaker.saturationPattern' );
const saturationLostQualitativeAlertPatternString = require( 'string!MOLARITY/a11y.saturationLostQualitativeAlertPattern' );
const saturationLostQuantitativeAlertPatternString = require( 'string!MOLARITY/a11y.saturationLostQuantitativeAlertPattern' );
const saturationReachedAlertPatternString = require( 'string!MOLARITY/a11y.saturationReachedAlertPattern' );
Expand Down
22 changes: 11 additions & 11 deletions js/molarity/view/describers/SoluteAmountDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ define( require => {
const Util = require( 'DOT/Util' );

// a11y strings
const beakerSoluteAmountPatternString = require( 'string!MOLARITY/a11y.beakerSoluteAmountPattern' );
const soluteAmountAndUnitPatternString = require( 'string!MOLARITY/a11y.soluteAmountAndUnitPattern' );
const soluteAmountChangedPatternString = require( 'string!MOLARITY/a11y.soluteAmountChangedPattern' );
const colorChangePatternString = require( 'string!MOLARITY/a11y.colorChangePattern' );
const qualitativeSoluteAmountStatePatternString = require( 'string!MOLARITY/a11y.qualitativeSoluteAmountStatePattern' );
const beakerSoluteAmountPatternString = require( 'string!MOLARITY/a11y.beaker.soluteAmountPattern' );
const quantitativeSoluteAmountAndUnitPatternString = require( 'string!MOLARITY/a11y.quantitative.soluteAmountAndUnitPattern' );
const quantityChangeSoluteAmountChangedPatternString = require( 'string!MOLARITY/a11y.quantityChange.soluteAmountChangedPattern' );
const quantityChangeColorChangePatternString = require( 'string!MOLARITY/a11y.quantityChange.colorChangePattern' );
const qualitativeSoluteAmountStatePatternString = require( 'string!MOLARITY/a11y.qualitative.soluteAmountStatePattern' );

// solute amount regions capitalized strings
const soluteAmountRegionsCapitalizedNoString = require( 'string!MOLARITY/a11y.soluteAmountRegions.capitalized.no' );
Expand All @@ -43,8 +43,8 @@ define( require => {
// change strings
const lessCapitalizedString = require( 'string!MOLARITY/a11y.less.capitalized' );
const moreCapitalizedString = require( 'string!MOLARITY/a11y.more.capitalized' );
const lighterString = require( 'string!MOLARITY/a11y.lighter' );
const darkerString = require( 'string!MOLARITY/a11y.darker' );
const quantityChangeLighterString = require( 'string!MOLARITY/a11y.quantityChange.lighter' );
const quantityChangeDarkerString = require( 'string!MOLARITY/a11y.quantityChange.darker' );

// constants
const SOLUTE_AMOUNT_STRINGS_CAPITALIZED = [
Expand Down Expand Up @@ -135,11 +135,11 @@ define( require => {
return {

// "quantity" meaning "solute amount" here
quantityChangeString: StringUtils.fillIn( soluteAmountChangedPatternString, {
quantityChangeString: StringUtils.fillIn( quantityChangeSoluteAmountChangedPatternString, {
moreLess: this.soluteAmountIncreased ? moreCapitalizedString : lessCapitalizedString
} ),
colorChangeString: StringUtils.fillIn( colorChangePatternString, {
lighterDarker: this.soluteAmountIncreased ? darkerString : lighterString
colorChangeString: StringUtils.fillIn( quantityChangeColorChangePatternString, {
lighterDarker: this.soluteAmountIncreased ? quantityChangeDarkerString : quantityChangeLighterString
} )
};
}
Expand All @@ -157,7 +157,7 @@ define( require => {
const soluteAmountMax = MolarityConstants.SOLUTE_AMOUNT_RANGE.max;
const clampedSoluteAmount = Util.clamp( this.soluteAmountProperty.value, soluteAmountMin, soluteAmountMax );

return StringUtils.fillIn( soluteAmountAndUnitPatternString, {
return StringUtils.fillIn( quantitativeSoluteAmountAndUnitPatternString, {
soluteAmount: Util.toFixed( clampedSoluteAmount, MolarityConstants.SOLUTE_AMOUNT_DECIMAL_PLACES )
} );
}
Expand Down
4 changes: 2 additions & 2 deletions js/molarity/view/describers/SoluteDescriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ define( require => {
const StringUtils = require( 'PHETCOMMON/util/StringUtils' );

// a11y strings
const beakerChemicalFormulaPatternString = require( 'string!MOLARITY/a11y.beakerChemicalFormulaPattern' );
const beakerChemicalFormulaPatternString = require( 'string!MOLARITY/a11y.beaker.chemicalFormulaPattern' );
const noSoluteAlertQuantitativeString = require( 'string!MOLARITY/a11y.noSoluteAlertQuantitative' );
const noSoluteAlertQualitativeString = require( 'string!MOLARITY/a11y.noSoluteAlertQualitative' );
const quantitativeConcentrationStatePatternString = require( 'string!MOLARITY/a11y.quantitativeConcentrationStatePattern' );
const quantitativeConcentrationStatePatternString = require( 'string!MOLARITY/a11y.quantitative.concentrationStatePattern' );
const soluteChangedQuantitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.soluteChangedQuantitativeConcentrationPattern' );
const soluteChangedQualitativeConcentrationPatternString = require( 'string!MOLARITY/a11y.soluteChangedQualitativeConcentrationPattern' );
const soluteChangedSaturatedAlertPatternString = require( 'string!MOLARITY/a11y.soluteChangedSaturatedAlertPattern' );
Expand Down
Loading

0 comments on commit 8d1a761

Please sign in to comment.