@@ -123,7 +123,7 @@ const SET_PYTHON_VARIABLE = {
123123 */
124124 init : function ( this : SetPythonVariableBlock ) : void {
125125 this . appendValueInput ( 'VALUE' )
126- . appendField ( 'set' )
126+ . appendField ( Blockly . Msg [ 'SET' ] )
127127 . appendField ( createFieldNonEditableText ( '' ) , FIELD_MODULE_OR_CLASS_NAME )
128128 . appendField ( '.' ) ;
129129 this . setStyle ( MRC_STYLE_VARIABLES ) ;
@@ -133,21 +133,27 @@ const SET_PYTHON_VARIABLE = {
133133 switch ( this . mrcVarKind ) {
134134 case VariableKind . MODULE : {
135135 const moduleName = this . getFieldValue ( FIELD_MODULE_OR_CLASS_NAME ) ;
136- tooltip = 'Sets the variable ' + moduleName + '.' + varName + '.' ;
136+ tooltip = Blockly . Msg [ 'SET_MODULE_VARIABLE_TOOLTIP' ]
137+ . replace ( '%1' , moduleName )
138+ . replace ( '%2' , varName ) ;
137139 break ;
138140 }
139141 case VariableKind . CLASS : {
140142 const className = this . getFieldValue ( FIELD_MODULE_OR_CLASS_NAME ) ;
141- tooltip = 'Sets the variable ' + className + '.' + varName + '.' ;
143+ tooltip = Blockly . Msg [ 'SET_CLASS_VARIABLE_TOOLTIP' ]
144+ . replace ( '%1' , className )
145+ . replace ( '%2' , varName ) ;
142146 break ;
143147 }
144148 case VariableKind . INSTANCE : {
145149 const className = this . getFieldValue ( FIELD_MODULE_OR_CLASS_NAME ) ;
146- tooltip = 'Sets the variable ' + varName + ' for the given ' + className + ' object.' ;
150+ tooltip = Blockly . Msg [ 'SET_INSTANCE_VARIABLE_TOOLTIP' ]
151+ . replace ( '%1' , varName )
152+ . replace ( '%2' , className ) ;
147153 break ;
148154 }
149155 default :
150- throw new Error ( 'mrcVarKind must be "module", "class", or "instance".' )
156+ throw new Error ( Blockly . Msg [ 'VAR_KIND_MUST_BE_MODULE_CLASS_OR_INSTANCE' ] ) ;
151157 }
152158 const varTooltips = PythonVariableSetterTooltips [ this . mrcKey ] ;
153159 if ( varTooltips ) {
@@ -226,7 +232,7 @@ const SET_PYTHON_VARIABLE = {
226232 } else {
227233 input . appendField ( createFieldNonEditableText ( '' ) , FIELD_VARIABLE_NAME ) ;
228234 }
229- input . appendField ( 'to' ) ;
235+ input . appendField ( Blockly . Msg [ 'TO' ] ) ;
230236 if ( this . mrcVarType ) {
231237 input . setCheck ( getAllowedTypesForSetCheck ( this . mrcVarType ) ) ;
232238 }
@@ -279,7 +285,7 @@ export const pythonFromBlock = function(
279285 return code ;
280286 }
281287 default :
282- throw new Error ( 'mrcVarKind must be "module", "class", or "instance".' )
288+ throw new Error ( Blockly . Msg [ 'VAR_KIND_MUST_BE_MODULE_CLASS_OR_INSTANCE' ] ) ;
283289 }
284290} ;
285291
0 commit comments