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 15c2a14 commit f4af234
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 31 deletions.
18 changes: 11 additions & 7 deletions js/common/view/RaysRadioButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import Property from '../../../../axon/js/Property.js';
import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js';

type SelfOptions = EmptySelfOptions;

Expand All @@ -39,10 +40,10 @@ export default class RaysRadioButtonGroup extends VerticalAquaRadioButtonGroup<R

// items for ray Mode radio buttons
const items = [
createItem( 'marginal', geometricOpticsStrings.radioButton.marginal, options.tandem, 'marginalRadioButton' ),
createItem( 'principal', geometricOpticsStrings.radioButton.principal, options.tandem, 'principalRadioButton' ),
createItem( 'many', geometricOpticsStrings.radioButton.many, options.tandem, 'manyRadioButton' ),
createItem( 'none', geometricOpticsStrings.radioButton.none, options.tandem, 'noneRadioButton' )
createItem( 'marginal', geometricOpticsStrings.radioButton.marginalStringProperty, options.tandem, 'marginalRadioButton' ),
createItem( 'principal', geometricOpticsStrings.radioButton.principalStringProperty, options.tandem, 'principalRadioButton' ),
createItem( 'many', geometricOpticsStrings.radioButton.manyStringProperty, options.tandem, 'manyRadioButton' ),
createItem( 'none', geometricOpticsStrings.radioButton.noneStringProperty, options.tandem, 'noneRadioButton' )
];

super( raysTypeProperty, items, options );
Expand All @@ -52,14 +53,17 @@ export default class RaysRadioButtonGroup extends VerticalAquaRadioButtonGroup<R
/**
* Creates an item for the radio button group.
* @param value - value associated with the radio button
* @param text - label that appears on the radio button
* @param labelStringProperty - label that appears on the radio button
* @param groupTandem - used to associate the item's tandem with the radio-button group
* @param itemTandemName - used to create the item's tandem
*/
function createItem( value: RaysType, text: string, groupTandem: Tandem, itemTandemName: string ): AquaRadioButtonGroupItem<RaysType> {
function createItem( value: RaysType,
labelStringProperty: TReadOnlyProperty<string>,
groupTandem: Tandem,
itemTandemName: string ): AquaRadioButtonGroupItem<RaysType> {
return {
value: value,
node: new Text( text, {
node: new Text( labelStringProperty, {
font: GOConstants.CONTROL_FONT,
maxWidth: 65,
tandem: groupTandem.createTandem( itemTandemName ).createTandem( 'labelText' ),
Expand Down
24 changes: 0 additions & 24 deletions js/geometric-optics-phet-io-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,6 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"geometricOptics.lensScreen.view.controls.controlPanel.opticSubpanel.visibleProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.manyRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.marginalRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.noneRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.principalRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.lensScreen.view.controls.controlPanel.raysSubpanel.visibleProperty": {
"phetioFeatured": true
},
Expand Down Expand Up @@ -508,18 +496,6 @@ window.phet.preloads.phetio.phetioElementsOverrides =
"geometricOptics.mirrorScreen.view.controls.controlPanel.opticSubpanel.visibleProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.manyRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.marginalRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.noneRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.raysSubpanel.raysRadioButtonGroup.principalRadioButton.labelText.textProperty": {
"phetioFeatured": true
},
"geometricOptics.mirrorScreen.view.controls.controlPanel.raysSubpanel.visibleProperty": {
"phetioFeatured": true
},
Expand Down

0 comments on commit f4af234

Please sign in to comment.