Skip to content

Commit

Permalink
support dynamic locale, #441
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 30, 2022
1 parent df0271d commit 1beec9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 38 deletions.
17 changes: 9 additions & 8 deletions js/common/view/VisibilityCheckboxGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ export default class VisibilityCheckboxGroup extends VerticalCheckboxGroup {
const focalPointItems = optic.isExclusivelyFlatMirror() ? [] : [

// Focal Points (F)
createItem( geometricOpticsStrings.checkbox.focalPoints, visibleProperties.focalPointsVisibleProperty, {
createItem( geometricOpticsStrings.checkbox.focalPointsStringProperty, visibleProperties.focalPointsVisibleProperty, {
iconNode: FocalPointNode.createIcon(),
tandem: options.tandem.createTandem( 'focalPointsCheckbox' )
} ),

// 2F Points
createItem( geometricOpticsStrings.checkbox.twoFPoints, visibleProperties.twoFPointsVisibleProperty, {
createItem( geometricOpticsStrings.checkbox.twoFPointsStringProperty, visibleProperties.twoFPointsVisibleProperty, {
iconNode: TwoFPointNode.createIcon(),
options: {
visibleProperty: GOPreferences.add2FPointsCheckboxProperty
Expand All @@ -78,20 +78,20 @@ export default class VisibilityCheckboxGroup extends VerticalCheckboxGroup {
...focalPointItems,

// Virtual Image
createItem( geometricOpticsStrings.checkbox.virtualImage, visibleProperties.virtualImageVisibleProperty, {
createItem( geometricOpticsStrings.checkbox.virtualImageStringProperty, visibleProperties.virtualImageVisibleProperty, {
options: {
enabledProperty: virtualImageCheckboxEnabledProperty
},
tandem: options.tandem.createTandem( 'virtualImageCheckbox' )
} ),

// Labels
createItem( geometricOpticsStrings.checkbox.labels, visibleProperties.labelsVisibleProperty, {
createItem( geometricOpticsStrings.checkbox.labelsStringProperty, visibleProperties.labelsVisibleProperty, {
tandem: options.tandem.createTandem( 'labelsCheckbox' )
} ),

// Second Point
createItem( geometricOpticsStrings.checkbox.secondPoint, visibleProperties.secondPointVisibleProperty, {
createItem( geometricOpticsStrings.checkbox.secondPointStringProperty, visibleProperties.secondPointVisibleProperty, {
iconNode: SecondPointNode.createIcon(),
options: {
visible: !options.isBasicsVersion
Expand All @@ -102,7 +102,7 @@ export default class VisibilityCheckboxGroup extends VerticalCheckboxGroup {

// Guides
if ( optic instanceof Lens ) {
items.push( createItem( geometricOpticsStrings.checkbox.guides, visibleProperties.guidesVisibleProperty, {
items.push( createItem( geometricOpticsStrings.checkbox.guidesStringProperty, visibleProperties.guidesVisibleProperty, {
iconNode: GuideNode.createIcon(),
options: {
visible: GOQueryParameters.addGuidesCheckbox
Expand All @@ -119,9 +119,10 @@ type ItemOptions = {
iconNode?: Node;
} & PickRequired<VerticalCheckboxGroupItem, 'tandem'> & PickOptional<VerticalCheckboxGroupItem, 'options'>;

function createItem( string: string, property: Property<boolean>, providedOptions: ItemOptions ): VerticalCheckboxGroupItem {
function createItem( labelStringProperty: TReadOnlyProperty<string>,
property: Property<boolean>, providedOptions: ItemOptions ): VerticalCheckboxGroupItem {

const labelText = new Text( string, {
const labelText = new Text( labelStringProperty, {
font: GOConstants.CONTROL_FONT,
maxWidth: 90,
tandem: providedOptions.tandem.createTandem( 'labelText' ),
Expand Down
30 changes: 0 additions & 30 deletions js/geometric-optics-phet-io-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,12 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"geometricOptics.lensScreen.model.tools.verticalRuler.positionProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.focalPointsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.guidesCheckbox.enabledProperty": {
"phetioFeatured": false
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.guidesCheckbox.visibleProperty": {
"phetioFeatured": false
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.labelsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.secondPointCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.twoFPointsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.virtualImageCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.checkboxGroup.visibleProperty": {
"phetioFeatured": true
},
Expand Down Expand Up @@ -424,21 +409,6 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"geometricOptics.mirrorScreen.model.tools.verticalRuler.positionProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.focalPointsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.labelsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.secondPointCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.twoFPointsCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.virtualImageCheckbox.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.checkboxGroup.visibleProperty": {
"phetioFeatured": true
},
Expand Down

0 comments on commit 1beec9c

Please sign in to comment.