Skip to content

Commit 3170b78

Browse files
committed
fix dynamic locale support for iceAgeStringProperty, clean up year constants, #288
1 parent db6a54c commit 3170b78

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

js/common/view/GreenhouseGasConcentrationPanel.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const noneStringProperty = GreenhouseEffectStrings.concentrationPanel.noneString
4040
const carbonDioxideConcentrationPatternStringProperty = GreenhouseEffectStrings.concentrationPanel.carbonDioxideConcentrationPatternStringProperty;
4141
const methaneConcentrationPatternStringProperty = GreenhouseEffectStrings.concentrationPanel.methaneConcentrationPatternStringProperty;
4242
const nitrousOxideConcentrationPatternStringProperty = GreenhouseEffectStrings.concentrationPanel.nitrousOxideConcentrationPatternStringProperty;
43+
const iceAgeStringProperty = GreenhouseEffectStrings.concentrationPanel.iceAgeStringProperty;
4344

4445
// Height in view coordinates of the concentration slider track (when controlling concentration by value) and the
4546
// concentration meter graphic (when controlling by date). These are the same height so that the positions of values
@@ -68,6 +69,11 @@ const SLIDER_THUMB_LINE_WIDTH = 1;
6869
// color of meters and controls in this panel
6970
const CONCENTRATION_CONTROLS_STROKE = 'black';
7071

72+
// numeric date representations are not translatable, see https://github.com/phetsims/greenhouse-effect/issues/21
73+
const STRING_2020 = '2020';
74+
const STRING_1950 = '1950';
75+
const STRING_1750 = '1750';
76+
7177
const RADIO_BUTTON_GROUP_OPTIONS = {
7278
radioButtonOptions: {
7379
baseColor: GreenhouseEffectColors.controlPanelBackgroundColorProperty,
@@ -194,34 +200,28 @@ class DateControl extends HBox {
194200
concentrationControlModeProperty: EnumerationProperty<ConcentrationControlMode>,
195201
tandem: Tandem ) {
196202

197-
// numeric date representations are not translatable, see https://github.com/phetsims/greenhouse-effect/issues/21
198-
const twentyTwentyLabel = '2020';
199-
const nineteenFiftyLabel = '1950';
200-
const seventeenFiftyLabel = '1750';
201-
const iceAgeLabel = GreenhouseEffectStrings.concentrationPanel.iceAgeStringProperty.value;
202-
203203
// the radio buttons for the date control
204204
const items = [
205205
{
206-
createNode: () => new Text( twentyTwentyLabel, LABEL_OPTIONS ),
206+
createNode: () => new Text( STRING_2020, LABEL_OPTIONS ),
207207
value: ConcentrationDate.YEAR_2020,
208208
labelContent: GreenhouseEffectStrings.a11y.concentrationPanel.timePeriod.yearTwentyTwentyStringProperty,
209209
tandemName: 'twentyTwentyRadioButton'
210210
},
211211
{
212-
createNode: () => new Text( nineteenFiftyLabel, LABEL_OPTIONS ),
212+
createNode: () => new Text( STRING_1950, LABEL_OPTIONS ),
213213
value: ConcentrationDate.YEAR_1950,
214214
labelContent: GreenhouseEffectStrings.a11y.concentrationPanel.timePeriod.yearNineteenFiftyStringProperty,
215215
tandemName: 'nineteenFiftyRadioButton'
216216
},
217217
{
218-
createNode: () => new Text( seventeenFiftyLabel, LABEL_OPTIONS ),
218+
createNode: () => new Text( STRING_1750, LABEL_OPTIONS ),
219219
value: ConcentrationDate.YEAR_1750,
220220
labelContent: GreenhouseEffectStrings.a11y.concentrationPanel.timePeriod.yearSeventeenFiftyStringProperty,
221221
tandemName: 'seventeenFiftyRadioButton'
222222
},
223223
{
224-
createNode: () => new Text( iceAgeLabel, LABEL_OPTIONS ),
224+
createNode: () => new Text( iceAgeStringProperty, LABEL_OPTIONS ),
225225
value: ConcentrationDate.ICE_AGE,
226226
labelContent: GreenhouseEffectStrings.a11y.concentrationPanel.timePeriod.iceAgeStringProperty,
227227
tandemName: 'iceAgeRadioButton'

0 commit comments

Comments
 (0)