From e69191f9de0a98e03615096aa5959235572b9fef Mon Sep 17 00:00:00 2001 From: Michael Barlow Date: Tue, 13 Mar 2018 14:09:15 -0600 Subject: [PATCH] require strings instead of string objects for translation, see https://github.com/phetsims/gravity-force-lab-basics/issues/56 --- gravity-force-lab-basics-strings_en.json | 42 +++++++++++++++++++ ...ravityForceLabBasicsKeyboardHelpContent.js | 23 +++++----- .../view/GravityForceLabBasicsScreenView.js | 5 +-- .../view/MassControl.js | 3 +- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/gravity-force-lab-basics-strings_en.json b/gravity-force-lab-basics-strings_en.json index bcb1df6..e9b9684 100644 --- a/gravity-force-lab-basics-strings_en.json +++ b/gravity-force-lab-basics-strings_en.json @@ -19,5 +19,47 @@ }, "billionKg": { "value": "billion kg" + }, + "moveMassHeading": { + "value": "Move Mass" + }, + "moveMassLabel": { + "value": "Move mass" + }, + "moveInLargerSteps": { + "value": "Move in larger steps" + }, + "jumpToLeft": { + "value": "Jump to left" + }, + "jumpToRight": { + "value": "Jump to right" + }, + "changeMassHeading": { + "value": "Change Mass" + }, + "increaseMass": { + "value": "Increase mass" + }, + "decreaseMass": { + "value": "Decrease mass" + }, + "changeMassInLargerSteps": { + "value": "Change mass in larger steps" + }, + "jumpToMaximumMass": { + "value": "Jump to maximum mass" + }, + "jumpToMinimumMass": { + "value": "Jump to minimum mass" + }, + "massReadoutPattern": { + "value": "{{value}} kilograms" + }, + "mass1ControlLabel": { + "value": "Mass 1" + }, + "mass2ControlLabel": { + "value": "Mass 2" } } \ No newline at end of file diff --git a/js/gravity-force-lab-basics/view/GravityForceLabBasicsKeyboardHelpContent.js b/js/gravity-force-lab-basics/view/GravityForceLabBasicsKeyboardHelpContent.js index f7a267b..91e94da 100644 --- a/js/gravity-force-lab-basics/view/GravityForceLabBasicsKeyboardHelpContent.js +++ b/js/gravity-force-lab-basics/view/GravityForceLabBasicsKeyboardHelpContent.js @@ -13,7 +13,6 @@ define( function( require ) { var ArrowKeyNode = require( 'SCENERY_PHET/keyboard/ArrowKeyNode' ); var EndKeyNode = require( 'SCENERY_PHET/keyboard/EndKeyNode' ); var GeneralNavigationHelpContent = require( 'SCENERY_PHET/keyboard/help/GeneralNavigationHelpContent' ); - var GFLBA11yStrings = require( 'GRAVITY_FORCE_LAB_BASICS/GFLBA11yStrings' ); var gravityForceLabBasics = require( 'GRAVITY_FORCE_LAB_BASICS/gravityForceLabBasics' ); var HBox = require( 'SCENERY/nodes/HBox' ); var HelpContent = require( 'SCENERY_PHET/keyboard/help/HelpContent' ); @@ -24,17 +23,17 @@ define( function( require ) { var VBox = require( 'SCENERY/nodes/VBox' ); // strings - var moveMassHeadingString = GFLBA11yStrings.moveMassHeadingString.value; - var moveMassLabelString = GFLBA11yStrings.moveMassLabelString.value; - var changeMassHeadingString = GFLBA11yStrings.changeMassHeadingString.value; - var moveInLargerStepsString = GFLBA11yStrings.moveInLargerStepsString.value; - var jumpToLeftString = GFLBA11yStrings.jumpToLeftString.value; - var jumpToRightString = GFLBA11yStrings.jumpToRightString.value; - var increaseMassString = GFLBA11yStrings.increaseMassString.value; - var decreaseMassString = GFLBA11yStrings.decreaseMassString.value; - var changeMassInLargerStepsString = GFLBA11yStrings.changeMassInLargerStepsString.value; - var jumpToMaximumMassString = GFLBA11yStrings.jumpToMaximumMassString.value; - var jumpToMinimumMassString = GFLBA11yStrings.jumpToMinimumMassString.value; + var moveMassHeadingString = require( 'string!GRAVITY_FORCE_LAB_BASICS/moveMassHeading' ); + var moveMassLabelString = require( 'string!GRAVITY_FORCE_LAB_BASICS/moveMassLabel' ); + var changeMassHeadingString = require( 'string!GRAVITY_FORCE_LAB_BASICS/changeMassHeading' ); + var moveInLargerStepsString = require( 'string!GRAVITY_FORCE_LAB_BASICS/moveInLargerSteps' ); + var jumpToLeftString = require( 'string!GRAVITY_FORCE_LAB_BASICS/jumpToLeft' ); + var jumpToRightString = require( 'string!GRAVITY_FORCE_LAB_BASICS/jumpToRight' ); + var increaseMassString = require( 'string!GRAVITY_FORCE_LAB_BASICS/increaseMass' ); + var decreaseMassString = require( 'string!GRAVITY_FORCE_LAB_BASICS/decreaseMass' ); + var changeMassInLargerStepsString = require( 'string!GRAVITY_FORCE_LAB_BASICS/changeMassInLargerSteps' ); + var jumpToMaximumMassString = require( 'string!GRAVITY_FORCE_LAB_BASICS/jumpToMaximumMass' ); + var jumpToMinimumMassString = require( 'string!GRAVITY_FORCE_LAB_BASICS/jumpToMinimumMass' ); // constants var DEFAULT_LABEL_OPTIONS = { diff --git a/js/gravity-force-lab-basics/view/GravityForceLabBasicsScreenView.js b/js/gravity-force-lab-basics/view/GravityForceLabBasicsScreenView.js index 04b6be0..68a5997 100644 --- a/js/gravity-force-lab-basics/view/GravityForceLabBasicsScreenView.js +++ b/js/gravity-force-lab-basics/view/GravityForceLabBasicsScreenView.js @@ -15,7 +15,6 @@ define( function( require ) { var DistanceArrowNode = require( 'GRAVITY_FORCE_LAB_BASICS/gravity-force-lab-basics/view/DistanceArrowNode' ); var GFLBMassNode = require( 'GRAVITY_FORCE_LAB_BASICS/gravity-force-lab-basics/view/GFLBMassNode' ); var gravityForceLabBasics = require( 'GRAVITY_FORCE_LAB_BASICS/gravityForceLabBasics' ); - var GFLBA11yStrings = require( 'GRAVITY_FORCE_LAB_BASICS/GFLBA11yStrings' ); var GravityForceLabBasicsConstants = require( 'GRAVITY_FORCE_LAB_BASICS/gravity-force-lab-basics/GravityForceLabBasicsConstants' ); var HBox = require( 'SCENERY/nodes/HBox' ); var inherit = require( 'PHET_CORE/inherit' ); @@ -46,8 +45,8 @@ define( function( require ) { var showValuesString = require( 'string!GRAVITY_FORCE_LAB_BASICS/showValues' ); // a11y strings - var mass1ControlLabelString = GFLBA11yStrings.mass1ControlLabelString.value; - var mass2ControlLabelString = GFLBA11yStrings.mass2ControlLabelString.value; + var mass1ControlLabelString = require( 'string!GRAVITY_FORCE_LAB_BASICS/mass1ControlLabel' ); + var mass2ControlLabelString = require( 'string!GRAVITY_FORCE_LAB_BASICS/mass2ControlLabel' ); /** * @param {GravityForceLabBasicsModel} model diff --git a/js/gravity-force-lab-basics/view/MassControl.js b/js/gravity-force-lab-basics/view/MassControl.js index e5a533d..aecc77b 100644 --- a/js/gravity-force-lab-basics/view/MassControl.js +++ b/js/gravity-force-lab-basics/view/MassControl.js @@ -12,7 +12,6 @@ define( function( require ) { var Color = require( 'SCENERY/util/Color' ); var gravityForceLabBasics = require( 'GRAVITY_FORCE_LAB_BASICS/gravityForceLabBasics' ); var GravityForceLabBasicsConstants = require( 'GRAVITY_FORCE_LAB_BASICS/gravity-force-lab-basics/GravityForceLabBasicsConstants' ); - var GFLBA11yStrings = require( 'GRAVITY_FORCE_LAB_BASICS/GFLBA11yStrings' ); var HBox = require( 'SCENERY/nodes/HBox' ); var inherit = require( 'PHET_CORE/inherit' ); var NumberPicker = require( 'SCENERY_PHET/NumberPicker' ); @@ -27,7 +26,7 @@ define( function( require ) { var billionKgString = require( 'string!GRAVITY_FORCE_LAB_BASICS/billionKg' ); // a11y strings - var massReadoutPatternString = GFLBA11yStrings.massReadoutPatternString.value; + var massReadoutPatternString = require( 'string!GRAVITY_FORCE_LAB_BASICS/massReadoutPattern' ); // constants var MIN_PANEL_WIDTH = 150;