Skip to content

Commit

Permalink
support for dynamic locale, #140
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 30, 2022
1 parent 98e1eb9 commit 211024e
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 44 deletions.
9 changes: 4 additions & 5 deletions js/common/view/PartialChargesCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class PartialChargesCheckbox extends Checkbox {
tandem: Tandem.REQUIRED
}, options );

const labelText = new Text( moleculePolarityStrings.partialCharges,
merge( {
tandem: options.tandem.createTandem( 'labelText' )
}, MPConstants.CONTROL_TEXT_OPTIONS )
);
const labelText = new Text( moleculePolarityStrings.partialChargesStringProperty, merge( {
tandem: options.tandem.createTandem( 'labelText' ),
phetioVisiblePropertyInstrumented: false
}, MPConstants.CONTROL_TEXT_OPTIONS ) );

super( partialChargesVisibleProperty, labelText, options );
}
Expand Down
5 changes: 3 additions & 2 deletions js/common/view/SurfaceColorControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class SurfaceColorControl extends VBox {
tandem: Tandem.REQUIRED
}, options );

const titleText = new Text( moleculePolarityStrings.surfaceColorRealMolecules, {
const titleText = new Text( moleculePolarityStrings.surfaceColorRealMoleculesStringProperty, {
font: new PhetFont( 14 ),
maxWidth: 400,
tandem: options.tandem.createTandem( 'titleText' )
tandem: options.tandem.createTandem( 'titleText' ),
phetioVisiblePropertyInstrumented: false
} );

const radioButtonGroup = new SurfaceColorRadioButtonGroup( surfaceColorProperty, {
Expand Down
9 changes: 4 additions & 5 deletions js/common/view/SurfaceControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ class SurfaceControl extends VBox {
}, options );

// title
const titleText = new Text( moleculePolarityStrings.surface,
merge( {
tandem: options.tandem.createTandem( 'titleText' )
}, MPConstants.CONTROL_PANEL_TITLE_OPTIONS )
);
const titleText = new Text( moleculePolarityStrings.surfaceStringProperty, merge( {
tandem: options.tandem.createTandem( 'titleText' ),
phetioVisiblePropertyInstrumented: false
}, MPConstants.CONTROL_PANEL_TITLE_OPTIONS ) );

// Radio button group
const radioButtonGroup = new SurfaceRadioButtonGroup( surfaceTypeProperty, {
Expand Down
15 changes: 9 additions & 6 deletions js/common/view/SurfaceRadioButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,26 @@ class SurfaceRadioButtonGroup extends AquaRadioButtonGroup {

const radioButtonGroupItems = [
{
node: new Text( moleculePolarityStrings.none, merge( {
tandem: options.tandem.createTandem( 'noneText' )
node: new Text( moleculePolarityStrings.noneStringProperty, merge( {
tandem: options.tandem.createTandem( 'noneText' ),
phetioVisiblePropertyInstrumented: false
}, MPConstants.CONTROL_TEXT_OPTIONS ) ),
value: SurfaceType.NONE,
tandemName: 'noneRadioButton'
},
{
value: SurfaceType.ELECTROSTATIC_POTENTIAL,
node: new Text( moleculePolarityStrings.electrostaticPotential, merge( {
tandem: options.tandem.createTandem( 'electrostaticPotentialText' )
node: new Text( moleculePolarityStrings.electrostaticPotentialStringProperty, merge( {
tandem: options.tandem.createTandem( 'electrostaticPotentialText' ),
phetioVisiblePropertyInstrumented: false
}, MPConstants.CONTROL_TEXT_OPTIONS ) ),
tandemName: 'electrostaticPotentialRadioButton'
},
{
value: SurfaceType.ELECTRON_DENSITY,
node: new Text( moleculePolarityStrings.electronDensity, merge( {
tandem: options.tandem.createTandem( 'electronDensityText' )
node: new Text( moleculePolarityStrings.electronDensityStringProperty, merge( {
tandem: options.tandem.createTandem( 'electronDensityText' ),
phetioVisiblePropertyInstrumented: false
}, MPConstants.CONTROL_TEXT_OPTIONS ) ),
tandemName: 'electronDensityRadioButton'
}
Expand Down
18 changes: 0 additions & 18 deletions js/molecule-polarity-phet-io-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"moleculePolarity.threeAtomsScreen.view.controlPanel.separator1.visibleProperty": {
"phetioFeatured": true
},
"moleculePolarity.threeAtomsScreen.view.controlPanel.viewControls.partialChargesCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.threeAtomsScreen.view.controlPanel.viewControls.titleText.textProperty": {
"phetioFeatured": true
},
Expand Down Expand Up @@ -160,30 +157,15 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"moleculePolarity.twoAtomsScreen.view.controlPanel.separator2.visibleProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.radioButtonGroup.electronDensityText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.radioButtonGroup.electrostaticPotentialText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.radioButtonGroup.noneText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.radioButtonGroup.visibleProperty": {
"phetioFeatured": false
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.titleText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.surfaceControl.visibleProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.bondCharacterCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.partialChargesCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.titleText.textProperty": {
"phetioFeatured": true
},
Expand Down
2 changes: 1 addition & 1 deletion js/realmolecules/RealMoleculesScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RealMoleculesScreen extends Screen {
constructor( options ) {

options = merge( {
name: moleculePolarityStrings.screen.realMolecules,
name: moleculePolarityStrings.screen.realMoleculesStringProperty,
backgroundColorProperty: new Property( MPColors.SCREEN_BACKGROUND ),
homeScreenIcon: createScreenIcon(),
tandem: Tandem.REQUIRED
Expand Down
8 changes: 4 additions & 4 deletions js/threeatoms/ThreeAtomsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ThreeAtomsScreen extends Screen {
constructor( options ) {

options = merge( {
name: moleculePolarityStrings.screen.threeAtoms,
name: moleculePolarityStrings.screen.threeAtomsStringProperty,
backgroundColorProperty: new Property( MPColors.SCREEN_BACKGROUND ),
homeScreenIcon: createScreenIcon(),
tandem: Tandem.REQUIRED
Expand Down Expand Up @@ -92,19 +92,19 @@ function createScreenIcon() {
centerY: bondBC.bottom
} );

const textA = new Text( moleculePolarityStrings.atomA, {
const textA = new Text( moleculePolarityStrings.atomAStringProperty, {
font: font,
maxWidth: 0.75 * atomDiameter,
center: atomA.center
} );

const textB = new Text( moleculePolarityStrings.atomB, {
const textB = new Text( moleculePolarityStrings.atomBStringProperty, {
font: font,
maxWidth: 0.75 * atomDiameter,
center: atomB.center
} );

const textC = new Text( moleculePolarityStrings.atomC, {
const textC = new Text( moleculePolarityStrings.atomCStringProperty, {
font: font,
maxWidth: 0.75 * atomDiameter,
center: atomC.center
Expand Down
6 changes: 3 additions & 3 deletions js/twoatoms/TwoAtomsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TwoAtomsScreen extends Screen {
constructor( options ) {

options = merge( {
name: moleculePolarityStrings.screen.twoAtoms,
name: moleculePolarityStrings.screen.twoAtomsStringProperty,
backgroundColorProperty: new Property( MPColors.SCREEN_BACKGROUND ),
homeScreenIcon: createScreenIcon(),
tandem: Tandem.REQUIRED
Expand Down Expand Up @@ -75,13 +75,13 @@ function createScreenIcon() {
y: bond.centerY
} );

const textA = new Text( moleculePolarityStrings.atomA, {
const textA = new Text( moleculePolarityStrings.atomAStringProperty, {
font: font,
maxWidth: 0.75 * atomDiameter,
center: atomA.center
} );

const textB = new Text( moleculePolarityStrings.atomB, {
const textB = new Text( moleculePolarityStrings.atomBStringProperty, {
font: font,
maxWidth: 0.75 * atomDiameter,
center: atomB.center
Expand Down

0 comments on commit 211024e

Please sign in to comment.