mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Use named properties on Msg.
This commit is contained in:
@@ -38,7 +38,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.COLOUR_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['COLOUR_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Colour.HUE = 20;
|
Blockly.Constants.Colour.HUE = 20;
|
||||||
|
|
||||||
|
|||||||
204
blocks/lists.js
204
blocks/lists.js
@@ -37,7 +37,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.LISTS_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['LISTS_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Lists.HUE = 260;
|
Blockly.Constants.Lists.HUE = 260;
|
||||||
|
|
||||||
@@ -132,13 +132,13 @@ Blockly.Blocks['lists_create_with'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_CREATE_WITH_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_CREATE_WITH_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.itemCount_ = 3;
|
this.itemCount_ = 3;
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
this.setOutput(true, 'Array');
|
this.setOutput(true, 'Array');
|
||||||
this.setMutator(new Blockly.Mutator(['lists_create_with_item']));
|
this.setMutator(new Blockly.Mutator(['lists_create_with_item']));
|
||||||
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP);
|
this.setTooltip(Blockly.Msg['LISTS_CREATE_WITH_TOOLTIP']);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Create XML to represent list inputs.
|
* Create XML to represent list inputs.
|
||||||
@@ -231,14 +231,14 @@ Blockly.Blocks['lists_create_with'] = {
|
|||||||
this.removeInput('EMPTY');
|
this.removeInput('EMPTY');
|
||||||
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
|
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
|
||||||
this.appendDummyInput('EMPTY')
|
this.appendDummyInput('EMPTY')
|
||||||
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
|
.appendField(Blockly.Msg['LISTS_CREATE_EMPTY_TITLE']);
|
||||||
}
|
}
|
||||||
// Add new inputs.
|
// Add new inputs.
|
||||||
for (var i = 0; i < this.itemCount_; i++) {
|
for (var i = 0; i < this.itemCount_; i++) {
|
||||||
if (!this.getInput('ADD' + i)) {
|
if (!this.getInput('ADD' + i)) {
|
||||||
var input = this.appendValueInput('ADD' + i);
|
var input = this.appendValueInput('ADD' + i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
|
input.appendField(Blockly.Msg['LISTS_CREATE_WITH_INPUT_WITH']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,11 +256,11 @@ Blockly.Blocks['lists_create_with_container'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);
|
.appendField(Blockly.Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD']);
|
||||||
this.appendStatementInput('STACK');
|
this.appendStatementInput('STACK');
|
||||||
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);
|
this.setTooltip(Blockly.Msg['LISTS_CREATE_WITH_CONTAINER_TOOLTIP']);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -271,12 +271,12 @@ Blockly.Blocks['lists_create_with_item'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);
|
.appendField(Blockly.Msg['LISTS_CREATE_WITH_ITEM_TITLE']);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);
|
this.setTooltip(Blockly.Msg['LISTS_CREATE_WITH_ITEM_TOOLTIP']);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -289,22 +289,22 @@ Blockly.Blocks['lists_indexOf'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
var OPERATORS =
|
var OPERATORS =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_INDEX_OF_FIRST, 'FIRST'],
|
[Blockly.Msg['LISTS_INDEX_OF_FIRST'], 'FIRST'],
|
||||||
[Blockly.Msg.LISTS_INDEX_OF_LAST, 'LAST']
|
[Blockly.Msg['LISTS_INDEX_OF_LAST'], 'LAST']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_INDEX_OF_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.setOutput(true, 'Number');
|
this.setOutput(true, 'Number');
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput('VALUE')
|
||||||
.setCheck('Array')
|
.setCheck('Array')
|
||||||
.appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);
|
.appendField(Blockly.Msg['LISTS_INDEX_OF_INPUT_IN_LIST']);
|
||||||
this.appendValueInput('FIND')
|
this.appendValueInput('FIND')
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'END');
|
.appendField(new Blockly.FieldDropdown(OPERATORS), 'END');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
return Blockly.Msg.LISTS_INDEX_OF_TOOLTIP.replace('%1',
|
return Blockly.Msg['LISTS_INDEX_OF_TOOLTIP'].replace('%1',
|
||||||
thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');
|
thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -318,34 +318,34 @@ Blockly.Blocks['lists_getIndex'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
var MODE =
|
var MODE =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_GET, 'GET'],
|
[Blockly.Msg['LISTS_GET_INDEX_GET'], 'GET'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE, 'GET_REMOVE'],
|
[Blockly.Msg['LISTS_GET_INDEX_GET_REMOVE'], 'GET_REMOVE'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_REMOVE, 'REMOVE']
|
[Blockly.Msg['LISTS_GET_INDEX_REMOVE'], 'REMOVE']
|
||||||
];
|
];
|
||||||
this.WHERE_OPTIONS =
|
this.WHERE_OPTIONS =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FROM_START, 'FROM_START'],
|
[Blockly.Msg['LISTS_GET_INDEX_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FROM_END, 'FROM_END'],
|
[Blockly.Msg['LISTS_GET_INDEX_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FIRST, 'FIRST'],
|
[Blockly.Msg['LISTS_GET_INDEX_FIRST'], 'FIRST'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_LAST, 'LAST'],
|
[Blockly.Msg['LISTS_GET_INDEX_LAST'], 'LAST'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_RANDOM, 'RANDOM']
|
[Blockly.Msg['LISTS_GET_INDEX_RANDOM'], 'RANDOM']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_GET_INDEX_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
var modeMenu = new Blockly.FieldDropdown(MODE, function(value) {
|
var modeMenu = new Blockly.FieldDropdown(MODE, function(value) {
|
||||||
var isStatement = (value == 'REMOVE');
|
var isStatement = (value == 'REMOVE');
|
||||||
this.sourceBlock_.updateStatement_(isStatement);
|
this.sourceBlock_.updateStatement_(isStatement);
|
||||||
});
|
});
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput('VALUE')
|
||||||
.setCheck('Array')
|
.setCheck('Array')
|
||||||
.appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);
|
.appendField(Blockly.Msg['LISTS_GET_INDEX_INPUT_IN_LIST']);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(modeMenu, 'MODE')
|
.appendField(modeMenu, 'MODE')
|
||||||
.appendField('', 'SPACE');
|
.appendField('', 'SPACE');
|
||||||
this.appendDummyInput('AT');
|
this.appendDummyInput('AT');
|
||||||
if (Blockly.Msg.LISTS_GET_INDEX_TAIL) {
|
if (Blockly.Msg['LISTS_GET_INDEX_TAIL']) {
|
||||||
this.appendDummyInput('TAIL')
|
this.appendDummyInput('TAIL')
|
||||||
.appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL);
|
.appendField(Blockly.Msg['LISTS_GET_INDEX_TAIL']);
|
||||||
}
|
}
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
@@ -359,48 +359,48 @@ Blockly.Blocks['lists_getIndex'] = {
|
|||||||
switch (mode + ' ' + where) {
|
switch (mode + ' ' + where) {
|
||||||
case 'GET FROM_START':
|
case 'GET FROM_START':
|
||||||
case 'GET FROM_END':
|
case 'GET FROM_END':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_FROM'];
|
||||||
break;
|
break;
|
||||||
case 'GET FIRST':
|
case 'GET FIRST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_FIRST'];
|
||||||
break;
|
break;
|
||||||
case 'GET LAST':
|
case 'GET LAST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_LAST'];
|
||||||
break;
|
break;
|
||||||
case 'GET RANDOM':
|
case 'GET RANDOM':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_RANDOM'];
|
||||||
break;
|
break;
|
||||||
case 'GET_REMOVE FROM_START':
|
case 'GET_REMOVE FROM_START':
|
||||||
case 'GET_REMOVE FROM_END':
|
case 'GET_REMOVE FROM_END':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM'];
|
||||||
break;
|
break;
|
||||||
case 'GET_REMOVE FIRST':
|
case 'GET_REMOVE FIRST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST'];
|
||||||
break;
|
break;
|
||||||
case 'GET_REMOVE LAST':
|
case 'GET_REMOVE LAST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST'];
|
||||||
break;
|
break;
|
||||||
case 'GET_REMOVE RANDOM':
|
case 'GET_REMOVE RANDOM':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM'];
|
||||||
break;
|
break;
|
||||||
case 'REMOVE FROM_START':
|
case 'REMOVE FROM_START':
|
||||||
case 'REMOVE FROM_END':
|
case 'REMOVE FROM_END':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM'];
|
||||||
break;
|
break;
|
||||||
case 'REMOVE FIRST':
|
case 'REMOVE FIRST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST'];
|
||||||
break;
|
break;
|
||||||
case 'REMOVE LAST':
|
case 'REMOVE LAST':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST'];
|
||||||
break;
|
break;
|
||||||
case 'REMOVE RANDOM':
|
case 'REMOVE RANDOM':
|
||||||
tooltip = Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM;
|
tooltip = Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (where == 'FROM_START' || where == 'FROM_END') {
|
if (where == 'FROM_START' || where == 'FROM_END') {
|
||||||
var msg = (where == 'FROM_START') ?
|
var msg = (where == 'FROM_START') ?
|
||||||
Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP :
|
Blockly.Msg['LISTS_INDEX_FROM_START_TOOLTIP'] :
|
||||||
Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP;
|
Blockly.Msg['LISTS_INDEX_FROM_END_TOOLTIP'];
|
||||||
tooltip += ' ' + msg.replace('%1',
|
tooltip += ' ' + msg.replace('%1',
|
||||||
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
||||||
}
|
}
|
||||||
@@ -469,9 +469,9 @@ Blockly.Blocks['lists_getIndex'] = {
|
|||||||
// Create either a value 'AT' input or a dummy input.
|
// Create either a value 'AT' input or a dummy input.
|
||||||
if (isAt) {
|
if (isAt) {
|
||||||
this.appendValueInput('AT').setCheck('Number');
|
this.appendValueInput('AT').setCheck('Number');
|
||||||
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
|
if (Blockly.Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||||
this.appendDummyInput('ORDINAL')
|
this.appendDummyInput('ORDINAL')
|
||||||
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
|
.appendField(Blockly.Msg['ORDINAL_NUMBER_SUFFIX']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.appendDummyInput('AT');
|
this.appendDummyInput('AT');
|
||||||
@@ -489,7 +489,7 @@ Blockly.Blocks['lists_getIndex'] = {
|
|||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
this.getInput('AT').appendField(menu, 'WHERE');
|
this.getInput('AT').appendField(menu, 'WHERE');
|
||||||
if (Blockly.Msg.LISTS_GET_INDEX_TAIL) {
|
if (Blockly.Msg['LISTS_GET_INDEX_TAIL']) {
|
||||||
this.moveInputBefore('TAIL', null);
|
this.moveInputBefore('TAIL', null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,32 +503,32 @@ Blockly.Blocks['lists_setIndex'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
var MODE =
|
var MODE =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_SET_INDEX_SET, 'SET'],
|
[Blockly.Msg['LISTS_SET_INDEX_SET'], 'SET'],
|
||||||
[Blockly.Msg.LISTS_SET_INDEX_INSERT, 'INSERT']
|
[Blockly.Msg['LISTS_SET_INDEX_INSERT'], 'INSERT']
|
||||||
];
|
];
|
||||||
this.WHERE_OPTIONS =
|
this.WHERE_OPTIONS =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FROM_START, 'FROM_START'],
|
[Blockly.Msg['LISTS_GET_INDEX_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FROM_END, 'FROM_END'],
|
[Blockly.Msg['LISTS_GET_INDEX_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_FIRST, 'FIRST'],
|
[Blockly.Msg['LISTS_GET_INDEX_FIRST'], 'FIRST'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_LAST, 'LAST'],
|
[Blockly.Msg['LISTS_GET_INDEX_LAST'], 'LAST'],
|
||||||
[Blockly.Msg.LISTS_GET_INDEX_RANDOM, 'RANDOM']
|
[Blockly.Msg['LISTS_GET_INDEX_RANDOM'], 'RANDOM']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_SET_INDEX_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_SET_INDEX_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.appendValueInput('LIST')
|
this.appendValueInput('LIST')
|
||||||
.setCheck('Array')
|
.setCheck('Array')
|
||||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
|
.appendField(Blockly.Msg['LISTS_SET_INDEX_INPUT_IN_LIST']);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(new Blockly.FieldDropdown(MODE), 'MODE')
|
.appendField(new Blockly.FieldDropdown(MODE), 'MODE')
|
||||||
.appendField('', 'SPACE');
|
.appendField('', 'SPACE');
|
||||||
this.appendDummyInput('AT');
|
this.appendDummyInput('AT');
|
||||||
this.appendValueInput('TO')
|
this.appendValueInput('TO')
|
||||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);
|
.appendField(Blockly.Msg['LISTS_SET_INDEX_INPUT_TO']);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP);
|
this.setTooltip(Blockly.Msg['LISTS_SET_INDEX_TOOLTIP']);
|
||||||
this.updateAt_(true);
|
this.updateAt_(true);
|
||||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -539,33 +539,33 @@ Blockly.Blocks['lists_setIndex'] = {
|
|||||||
switch (mode + ' ' + where) {
|
switch (mode + ' ' + where) {
|
||||||
case 'SET FROM_START':
|
case 'SET FROM_START':
|
||||||
case 'SET FROM_END':
|
case 'SET FROM_END':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_SET_FROM'];
|
||||||
break;
|
break;
|
||||||
case 'SET FIRST':
|
case 'SET FIRST':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_SET_FIRST'];
|
||||||
break;
|
break;
|
||||||
case 'SET LAST':
|
case 'SET LAST':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_SET_LAST'];
|
||||||
break;
|
break;
|
||||||
case 'SET RANDOM':
|
case 'SET RANDOM':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_SET_RANDOM'];
|
||||||
break;
|
break;
|
||||||
case 'INSERT FROM_START':
|
case 'INSERT FROM_START':
|
||||||
case 'INSERT FROM_END':
|
case 'INSERT FROM_END':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_FROM'];
|
||||||
break;
|
break;
|
||||||
case 'INSERT FIRST':
|
case 'INSERT FIRST':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST'];
|
||||||
break;
|
break;
|
||||||
case 'INSERT LAST':
|
case 'INSERT LAST':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_LAST'];
|
||||||
break;
|
break;
|
||||||
case 'INSERT RANDOM':
|
case 'INSERT RANDOM':
|
||||||
tooltip = Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM;
|
tooltip = Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (where == 'FROM_START' || where == 'FROM_END') {
|
if (where == 'FROM_START' || where == 'FROM_END') {
|
||||||
tooltip += ' ' + Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP
|
tooltip += ' ' + Blockly.Msg['LISTS_INDEX_FROM_START_TOOLTIP']
|
||||||
.replace('%1',
|
.replace('%1',
|
||||||
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
||||||
}
|
}
|
||||||
@@ -607,9 +607,9 @@ Blockly.Blocks['lists_setIndex'] = {
|
|||||||
// Create either a value 'AT' input or a dummy input.
|
// Create either a value 'AT' input or a dummy input.
|
||||||
if (isAt) {
|
if (isAt) {
|
||||||
this.appendValueInput('AT').setCheck('Number');
|
this.appendValueInput('AT').setCheck('Number');
|
||||||
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
|
if (Blockly.Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||||
this.appendDummyInput('ORDINAL')
|
this.appendDummyInput('ORDINAL')
|
||||||
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
|
.appendField(Blockly.Msg['ORDINAL_NUMBER_SUFFIX']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.appendDummyInput('AT');
|
this.appendDummyInput('AT');
|
||||||
@@ -643,32 +643,32 @@ Blockly.Blocks['lists_getSublist'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
this['WHERE_OPTIONS_1'] =
|
this['WHERE_OPTIONS_1'] =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START, 'FROM_START'],
|
[Blockly.Msg['LISTS_GET_SUBLIST_START_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END, 'FROM_END'],
|
[Blockly.Msg['LISTS_GET_SUBLIST_START_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST, 'FIRST']
|
[Blockly.Msg['LISTS_GET_SUBLIST_START_FIRST'], 'FIRST']
|
||||||
];
|
];
|
||||||
this['WHERE_OPTIONS_2'] =
|
this['WHERE_OPTIONS_2'] =
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START, 'FROM_START'],
|
[Blockly.Msg['LISTS_GET_SUBLIST_END_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END, 'FROM_END'],
|
[Blockly.Msg['LISTS_GET_SUBLIST_END_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.LISTS_GET_SUBLIST_END_LAST, 'LAST']
|
[Blockly.Msg['LISTS_GET_SUBLIST_END_LAST'], 'LAST']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_GET_SUBLIST_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.appendValueInput('LIST')
|
this.appendValueInput('LIST')
|
||||||
.setCheck('Array')
|
.setCheck('Array')
|
||||||
.appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);
|
.appendField(Blockly.Msg['LISTS_GET_SUBLIST_INPUT_IN_LIST']);
|
||||||
this.appendDummyInput('AT1');
|
this.appendDummyInput('AT1');
|
||||||
this.appendDummyInput('AT2');
|
this.appendDummyInput('AT2');
|
||||||
if (Blockly.Msg.LISTS_GET_SUBLIST_TAIL) {
|
if (Blockly.Msg['LISTS_GET_SUBLIST_TAIL']) {
|
||||||
this.appendDummyInput('TAIL')
|
this.appendDummyInput('TAIL')
|
||||||
.appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);
|
.appendField(Blockly.Msg['LISTS_GET_SUBLIST_TAIL']);
|
||||||
}
|
}
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true, 'Array');
|
this.setOutput(true, 'Array');
|
||||||
this.updateAt_(1, true);
|
this.updateAt_(1, true);
|
||||||
this.updateAt_(2, true);
|
this.updateAt_(2, true);
|
||||||
this.setTooltip(Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP);
|
this.setTooltip(Blockly.Msg['LISTS_GET_SUBLIST_TOOLTIP']);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Create XML to represent whether there are 'AT' inputs.
|
* Create XML to represent whether there are 'AT' inputs.
|
||||||
@@ -710,9 +710,9 @@ Blockly.Blocks['lists_getSublist'] = {
|
|||||||
// Create either a value 'AT' input or a dummy input.
|
// Create either a value 'AT' input or a dummy input.
|
||||||
if (isAt) {
|
if (isAt) {
|
||||||
this.appendValueInput('AT' + n).setCheck('Number');
|
this.appendValueInput('AT' + n).setCheck('Number');
|
||||||
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
|
if (Blockly.Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||||
this.appendDummyInput('ORDINAL' + n)
|
this.appendDummyInput('ORDINAL' + n)
|
||||||
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
|
.appendField(Blockly.Msg['ORDINAL_NUMBER_SUFFIX']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.appendDummyInput('AT' + n);
|
this.appendDummyInput('AT' + n);
|
||||||
@@ -740,7 +740,7 @@ Blockly.Blocks['lists_getSublist'] = {
|
|||||||
this.moveInputBefore('ORDINAL1', 'AT2');
|
this.moveInputBefore('ORDINAL1', 'AT2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Blockly.Msg.LISTS_GET_SUBLIST_TAIL) {
|
if (Blockly.Msg['LISTS_GET_SUBLIST_TAIL']) {
|
||||||
this.moveInputBefore('TAIL', null);
|
this.moveInputBefore('TAIL', null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,23 +753,23 @@ Blockly.Blocks['lists_sort'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.LISTS_SORT_TITLE,
|
"message0": Blockly.Msg['LISTS_SORT_TITLE'],
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "field_dropdown",
|
"type": "field_dropdown",
|
||||||
"name": "TYPE",
|
"name": "TYPE",
|
||||||
"options": [
|
"options": [
|
||||||
[Blockly.Msg.LISTS_SORT_TYPE_NUMERIC, "NUMERIC"],
|
[Blockly.Msg['LISTS_SORT_TYPE_NUMERIC'], "NUMERIC"],
|
||||||
[Blockly.Msg.LISTS_SORT_TYPE_TEXT, "TEXT"],
|
[Blockly.Msg['LISTS_SORT_TYPE_TEXT'], "TEXT"],
|
||||||
[Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE, "IGNORE_CASE"]
|
[Blockly.Msg['LISTS_SORT_TYPE_IGNORECASE'], "IGNORE_CASE"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "field_dropdown",
|
"type": "field_dropdown",
|
||||||
"name": "DIRECTION",
|
"name": "DIRECTION",
|
||||||
"options": [
|
"options": [
|
||||||
[Blockly.Msg.LISTS_SORT_ORDER_ASCENDING, "1"],
|
[Blockly.Msg['LISTS_SORT_ORDER_ASCENDING'], "1"],
|
||||||
[Blockly.Msg.LISTS_SORT_ORDER_DESCENDING, "-1"]
|
[Blockly.Msg['LISTS_SORT_ORDER_DESCENDING'], "-1"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -779,9 +779,9 @@ Blockly.Blocks['lists_sort'] = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"output": "Array",
|
"output": "Array",
|
||||||
"colour": Blockly.Msg.LISTS_HUE,
|
"colour": Blockly.Msg['LISTS_HUE'],
|
||||||
"tooltip": Blockly.Msg.LISTS_SORT_TOOLTIP,
|
"tooltip": Blockly.Msg['LISTS_SORT_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.LISTS_SORT_HELPURL
|
"helpUrl": Blockly.Msg['LISTS_SORT_HELPURL']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -796,28 +796,28 @@ Blockly.Blocks['lists_split'] = {
|
|||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
var dropdown = new Blockly.FieldDropdown(
|
var dropdown = new Blockly.FieldDropdown(
|
||||||
[
|
[
|
||||||
[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT, 'SPLIT'],
|
[Blockly.Msg['LISTS_SPLIT_LIST_FROM_TEXT'], 'SPLIT'],
|
||||||
[Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST, 'JOIN']
|
[Blockly.Msg['LISTS_SPLIT_TEXT_FROM_LIST'], 'JOIN']
|
||||||
],
|
],
|
||||||
function(newMode) {
|
function(newMode) {
|
||||||
thisBlock.updateType_(newMode);
|
thisBlock.updateType_(newMode);
|
||||||
});
|
});
|
||||||
this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);
|
this.setHelpUrl(Blockly.Msg['LISTS_SPLIT_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.LISTS_HUE);
|
this.setColour(Blockly.Msg['LISTS_HUE']);
|
||||||
this.appendValueInput('INPUT')
|
this.appendValueInput('INPUT')
|
||||||
.setCheck('String')
|
.setCheck('String')
|
||||||
.appendField(dropdown, 'MODE');
|
.appendField(dropdown, 'MODE');
|
||||||
this.appendValueInput('DELIM')
|
this.appendValueInput('DELIM')
|
||||||
.setCheck('String')
|
.setCheck('String')
|
||||||
.appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);
|
.appendField(Blockly.Msg['LISTS_SPLIT_WITH_DELIMITER']);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true, 'Array');
|
this.setOutput(true, 'Array');
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
var mode = thisBlock.getFieldValue('MODE');
|
var mode = thisBlock.getFieldValue('MODE');
|
||||||
if (mode == 'SPLIT') {
|
if (mode == 'SPLIT') {
|
||||||
return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;
|
return Blockly.Msg['LISTS_SPLIT_TOOLTIP_SPLIT'];
|
||||||
} else if (mode == 'JOIN') {
|
} else if (mode == 'JOIN') {
|
||||||
return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;
|
return Blockly.Msg['LISTS_SPLIT_TOOLTIP_JOIN'];
|
||||||
}
|
}
|
||||||
throw 'Unknown mode: ' + mode;
|
throw 'Unknown mode: ' + mode;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.LOGIC_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['LOGIC_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Logic.HUE = 210;
|
Blockly.Constants.Logic.HUE = 210;
|
||||||
|
|
||||||
@@ -445,13 +445,13 @@ Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN = {
|
|||||||
for (var i = 1; i <= this.elseifCount_; i++) {
|
for (var i = 1; i <= this.elseifCount_; i++) {
|
||||||
this.appendValueInput('IF' + i)
|
this.appendValueInput('IF' + i)
|
||||||
.setCheck('Boolean')
|
.setCheck('Boolean')
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
|
.appendField(Blockly.Msg['CONTROLS_IF_MSG_ELSEIF']);
|
||||||
this.appendStatementInput('DO' + i)
|
this.appendStatementInput('DO' + i)
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
|
.appendField(Blockly.Msg['CONTROLS_IF_MSG_THEN']);
|
||||||
}
|
}
|
||||||
if (this.elseCount_) {
|
if (this.elseCount_) {
|
||||||
this.appendStatementInput('ELSE')
|
this.appendStatementInput('ELSE')
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
.appendField(Blockly.Msg['CONTROLS_IF_MSG_ELSE']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -469,13 +469,13 @@ Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION = function() {
|
|||||||
|
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
if (!this.elseifCount_ && !this.elseCount_) {
|
if (!this.elseifCount_ && !this.elseCount_) {
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_1;
|
return Blockly.Msg['CONTROLS_IF_TOOLTIP_1'];
|
||||||
} else if (!this.elseifCount_ && this.elseCount_) {
|
} else if (!this.elseifCount_ && this.elseCount_) {
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_2;
|
return Blockly.Msg['CONTROLS_IF_TOOLTIP_2'];
|
||||||
} else if (this.elseifCount_ && !this.elseCount_) {
|
} else if (this.elseifCount_ && !this.elseCount_) {
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_3;
|
return Blockly.Msg['CONTROLS_IF_TOOLTIP_3'];
|
||||||
} else if (this.elseifCount_ && this.elseCount_) {
|
} else if (this.elseifCount_ && this.elseCount_) {
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_4;
|
return Blockly.Msg['CONTROLS_IF_TOOLTIP_4'];
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.LOOPS_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['LOOPS_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Loops.HUE = 120;
|
Blockly.Constants.Loops.HUE = 120;
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {
|
|||||||
if (!this.isCollapsed() && varName != null) {
|
if (!this.isCollapsed() && varName != null) {
|
||||||
var option = {enabled: true};
|
var option = {enabled: true};
|
||||||
option.text =
|
option.text =
|
||||||
Blockly.Msg.VARIABLES_SET_CREATE_GET.replace('%1', varName);
|
Blockly.Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName);
|
||||||
var xmlField = Blockly.Variables.generateVariableFieldDom(variable);
|
var xmlField = Blockly.Variables.generateVariableFieldDom(variable);
|
||||||
var xmlBlock = goog.dom.createDom('block', null, xmlField);
|
var xmlBlock = goog.dom.createDom('block', null, xmlField);
|
||||||
xmlBlock.setAttribute('type', 'variables_get');
|
xmlBlock.setAttribute('type', 'variables_get');
|
||||||
@@ -330,7 +330,7 @@ Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {
|
|||||||
this.setDisabled(false);
|
this.setDisabled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg['CONTROLS_FLOW_STATEMENTS_WARNING']);
|
||||||
if (!this.isInFlyout && !this.getInheritedDisabled()) {
|
if (!this.isInFlyout && !this.getInheritedDisabled()) {
|
||||||
this.setDisabled(true);
|
this.setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.MATH_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['MATH_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Math.HUE = 230;
|
Blockly.Constants.Math.HUE = 230;
|
||||||
|
|
||||||
|
|||||||
@@ -40,19 +40,19 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
|||||||
Blockly.Procedures.rename);
|
Blockly.Procedures.rename);
|
||||||
nameField.setSpellcheck(false);
|
nameField.setSpellcheck(false);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE)
|
.appendField(Blockly.Msg['PROCEDURES_DEFNORETURN_TITLE'])
|
||||||
.appendField(nameField, 'NAME')
|
.appendField(nameField, 'NAME')
|
||||||
.appendField('', 'PARAMS');
|
.appendField('', 'PARAMS');
|
||||||
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
||||||
if ((this.workspace.options.comments ||
|
if ((this.workspace.options.comments ||
|
||||||
(this.workspace.options.parentWorkspace &&
|
(this.workspace.options.parentWorkspace &&
|
||||||
this.workspace.options.parentWorkspace.options.comments)) &&
|
this.workspace.options.parentWorkspace.options.comments)) &&
|
||||||
Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT) {
|
Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']) {
|
||||||
this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);
|
this.setCommentText(Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']);
|
||||||
}
|
}
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);
|
this.setTooltip(Blockly.Msg['PROCEDURES_DEFNORETURN_TOOLTIP']);
|
||||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_DEFNORETURN_HELPURL']);
|
||||||
this.arguments_ = [];
|
this.arguments_ = [];
|
||||||
this.argumentVarModels_ = [];
|
this.argumentVarModels_ = [];
|
||||||
this.setStatements_(true);
|
this.setStatements_(true);
|
||||||
@@ -69,7 +69,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
|||||||
}
|
}
|
||||||
if (hasStatements) {
|
if (hasStatements) {
|
||||||
this.appendStatementInput('STACK')
|
this.appendStatementInput('STACK')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO);
|
.appendField(Blockly.Msg['PROCEDURES_DEFNORETURN_DO']);
|
||||||
if (this.getInput('RETURN')) {
|
if (this.getInput('RETURN')) {
|
||||||
this.moveInputBefore('STACK', 'RETURN');
|
this.moveInputBefore('STACK', 'RETURN');
|
||||||
}
|
}
|
||||||
@@ -96,14 +96,14 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
|||||||
hash['arg_' + this.arguments_[i].toLowerCase()] = true;
|
hash['arg_' + this.arguments_[i].toLowerCase()] = true;
|
||||||
}
|
}
|
||||||
if (badArg) {
|
if (badArg) {
|
||||||
this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING);
|
this.setWarningText(Blockly.Msg['PROCEDURES_DEF_DUPLICATE_WARNING']);
|
||||||
} else {
|
} else {
|
||||||
this.setWarningText(null);
|
this.setWarningText(null);
|
||||||
}
|
}
|
||||||
// Merge the arguments into a human-readable list.
|
// Merge the arguments into a human-readable list.
|
||||||
var paramString = '';
|
var paramString = '';
|
||||||
if (this.arguments_.length) {
|
if (this.arguments_.length) {
|
||||||
paramString = Blockly.Msg.PROCEDURES_BEFORE_PARAMS +
|
paramString = Blockly.Msg['PROCEDURES_BEFORE_PARAMS'] +
|
||||||
' ' + this.arguments_.join(', ');
|
' ' + this.arguments_.join(', ');
|
||||||
}
|
}
|
||||||
// The params field is deterministic based on the mutation,
|
// The params field is deterministic based on the mutation,
|
||||||
@@ -356,7 +356,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
|||||||
// Add option to create caller.
|
// Add option to create caller.
|
||||||
var option = {enabled: true};
|
var option = {enabled: true};
|
||||||
var name = this.getFieldValue('NAME');
|
var name = this.getFieldValue('NAME');
|
||||||
option.text = Blockly.Msg.PROCEDURES_CREATE_DO.replace('%1', name);
|
option.text = Blockly.Msg['PROCEDURES_CREATE_DO'].replace('%1', name);
|
||||||
var xmlMutation = goog.dom.createDom('mutation');
|
var xmlMutation = goog.dom.createDom('mutation');
|
||||||
xmlMutation.setAttribute('name', name);
|
xmlMutation.setAttribute('name', name);
|
||||||
for (var i = 0; i < this.arguments_.length; i++) {
|
for (var i = 0; i < this.arguments_.length; i++) {
|
||||||
@@ -375,7 +375,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
|||||||
var option = {enabled: true};
|
var option = {enabled: true};
|
||||||
var argVar = this.argumentVarModels_[i];
|
var argVar = this.argumentVarModels_[i];
|
||||||
var name = argVar.name;
|
var name = argVar.name;
|
||||||
option.text = Blockly.Msg.VARIABLES_SET_CREATE_GET.replace('%1', name);
|
option.text = Blockly.Msg['VARIABLES_SET_CREATE_GET'].replace('%1', name);
|
||||||
|
|
||||||
var xmlField = Blockly.Variables.generateVariableFieldDom(argVar);
|
var xmlField = Blockly.Variables.generateVariableFieldDom(argVar);
|
||||||
var xmlBlock = goog.dom.createDom('block', null, xmlField);
|
var xmlBlock = goog.dom.createDom('block', null, xmlField);
|
||||||
@@ -398,22 +398,22 @@ Blockly.Blocks['procedures_defreturn'] = {
|
|||||||
Blockly.Procedures.rename);
|
Blockly.Procedures.rename);
|
||||||
nameField.setSpellcheck(false);
|
nameField.setSpellcheck(false);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_TITLE'])
|
||||||
.appendField(nameField, 'NAME')
|
.appendField(nameField, 'NAME')
|
||||||
.appendField('', 'PARAMS');
|
.appendField('', 'PARAMS');
|
||||||
this.appendValueInput('RETURN')
|
this.appendValueInput('RETURN')
|
||||||
.setAlign(Blockly.ALIGN_RIGHT)
|
.setAlign(Blockly.ALIGN_RIGHT)
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']);
|
||||||
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
|
||||||
if ((this.workspace.options.comments ||
|
if ((this.workspace.options.comments ||
|
||||||
(this.workspace.options.parentWorkspace &&
|
(this.workspace.options.parentWorkspace &&
|
||||||
this.workspace.options.parentWorkspace.options.comments)) &&
|
this.workspace.options.parentWorkspace.options.comments)) &&
|
||||||
Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT) {
|
Blockly.Msg['PROCEDURES_DEFRETURN_COMMENT']) {
|
||||||
this.setCommentText(Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT);
|
this.setCommentText(Blockly.Msg['PROCEDURES_DEFRETURN_COMMENT']);
|
||||||
}
|
}
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);
|
this.setTooltip(Blockly.Msg['PROCEDURES_DEFRETURN_TOOLTIP']);
|
||||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_DEFRETURN_HELPURL']);
|
||||||
this.arguments_ = [];
|
this.arguments_ = [];
|
||||||
this.argumentVarModels_ = [];
|
this.argumentVarModels_ = [];
|
||||||
this.setStatements_(true);
|
this.setStatements_(true);
|
||||||
@@ -452,13 +452,13 @@ Blockly.Blocks['procedures_mutatorcontainer'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);
|
.appendField(Blockly.Msg['PROCEDURES_MUTATORCONTAINER_TITLE']);
|
||||||
this.appendStatementInput('STACK');
|
this.appendStatementInput('STACK');
|
||||||
this.appendDummyInput('STATEMENT_INPUT')
|
this.appendDummyInput('STATEMENT_INPUT')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS)
|
.appendField(Blockly.Msg['PROCEDURES_ALLOW_STATEMENTS'])
|
||||||
.appendField(new Blockly.FieldCheckbox('TRUE'), 'STATEMENTS');
|
.appendField(new Blockly.FieldCheckbox('TRUE'), 'STATEMENTS');
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);
|
this.setTooltip(Blockly.Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -480,12 +480,12 @@ Blockly.Blocks['procedures_mutatorarg'] = {
|
|||||||
field.showEditor_ = newShowEditorFn;
|
field.showEditor_ = newShowEditorFn;
|
||||||
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE)
|
.appendField(Blockly.Msg['PROCEDURES_MUTATORARG_TITLE'])
|
||||||
.appendField(field, 'NAME');
|
.appendField(field, 'NAME');
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);
|
this.setTooltip(Blockly.Msg['PROCEDURES_MUTATORARG_TOOLTIP']);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
|
|
||||||
// Create the default variable when we drag the block in from the flyout.
|
// Create the default variable when we drag the block in from the flyout.
|
||||||
@@ -557,9 +557,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
|||||||
.appendField(this.id, 'NAME');
|
.appendField(this.id, 'NAME');
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
// Tooltip is set in renameProcedure.
|
// Tooltip is set in renameProcedure.
|
||||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_CALLNORETURN_HELPURL']);
|
||||||
this.arguments_ = [];
|
this.arguments_ = [];
|
||||||
this.argumentVarModels_ = [];
|
this.argumentVarModels_ = [];
|
||||||
this.quarkConnections_ = {};
|
this.quarkConnections_ = {};
|
||||||
@@ -585,8 +585,8 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
|||||||
if (Blockly.Names.equals(oldName, this.getProcedureCall())) {
|
if (Blockly.Names.equals(oldName, this.getProcedureCall())) {
|
||||||
this.setFieldValue(newName, 'NAME');
|
this.setFieldValue(newName, 'NAME');
|
||||||
var baseMsg = this.outputConnection ?
|
var baseMsg = this.outputConnection ?
|
||||||
Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP :
|
Blockly.Msg['PROCEDURES_CALLRETURN_TOOLTIP'] :
|
||||||
Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP;
|
Blockly.Msg['PROCEDURES_CALLNORETURN_TOOLTIP'];
|
||||||
this.setTooltip(baseMsg.replace('%1', newName));
|
this.setTooltip(baseMsg.replace('%1', newName));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -726,7 +726,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
|||||||
if (topRow) {
|
if (topRow) {
|
||||||
if (this.arguments_.length) {
|
if (this.arguments_.length) {
|
||||||
if (!this.getField('WITH')) {
|
if (!this.getField('WITH')) {
|
||||||
topRow.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
|
topRow.appendField(Blockly.Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH');
|
||||||
topRow.init();
|
topRow.init();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -851,7 +851,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
|||||||
*/
|
*/
|
||||||
customContextMenu: function(options) {
|
customContextMenu: function(options) {
|
||||||
var option = {enabled: true};
|
var option = {enabled: true};
|
||||||
option.text = Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;
|
option.text = Blockly.Msg['PROCEDURES_HIGHLIGHT_DEF'];
|
||||||
var name = this.getProcedureCall();
|
var name = this.getProcedureCall();
|
||||||
var workspace = this.workspace;
|
var workspace = this.workspace;
|
||||||
option.callback = function() {
|
option.callback = function() {
|
||||||
@@ -875,9 +875,9 @@ Blockly.Blocks['procedures_callreturn'] = {
|
|||||||
this.appendDummyInput('TOPROW')
|
this.appendDummyInput('TOPROW')
|
||||||
.appendField('', 'NAME');
|
.appendField('', 'NAME');
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
// Tooltip is set in domToMutation.
|
// Tooltip is set in domToMutation.
|
||||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_CALLRETURN_HELPURL']);
|
||||||
this.arguments_ = [];
|
this.arguments_ = [];
|
||||||
this.quarkConnections_ = {};
|
this.quarkConnections_ = {};
|
||||||
this.quarkIds_ = null;
|
this.quarkIds_ = null;
|
||||||
@@ -904,15 +904,15 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
this.appendValueInput('CONDITION')
|
this.appendValueInput('CONDITION')
|
||||||
.setCheck('Boolean')
|
.setCheck('Boolean')
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
|
.appendField(Blockly.Msg['CONTROLS_IF_MSG_IF']);
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput('VALUE')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setColour(Blockly.Msg.PROCEDURES_HUE);
|
this.setColour(Blockly.Msg['PROCEDURES_HUE']);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);
|
this.setTooltip(Blockly.Msg['PROCEDURES_IFRETURN_TOOLTIP']);
|
||||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_IFRETURN_HELPURL);
|
this.setHelpUrl(Blockly.Msg['PROCEDURES_IFRETURN_HELPURL']);
|
||||||
this.hasReturnValue_ = true;
|
this.hasReturnValue_ = true;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -936,7 +936,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
|||||||
if (!this.hasReturnValue_) {
|
if (!this.hasReturnValue_) {
|
||||||
this.removeInput('VALUE');
|
this.removeInput('VALUE');
|
||||||
this.appendDummyInput('VALUE')
|
this.appendDummyInput('VALUE')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -964,13 +964,13 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
|||||||
if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) {
|
if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) {
|
||||||
this.removeInput('VALUE');
|
this.removeInput('VALUE');
|
||||||
this.appendDummyInput('VALUE')
|
this.appendDummyInput('VALUE')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']);
|
||||||
this.hasReturnValue_ = false;
|
this.hasReturnValue_ = false;
|
||||||
} else if (block.type == 'procedures_defreturn' &&
|
} else if (block.type == 'procedures_defreturn' &&
|
||||||
!this.hasReturnValue_) {
|
!this.hasReturnValue_) {
|
||||||
this.removeInput('VALUE');
|
this.removeInput('VALUE');
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput('VALUE')
|
||||||
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
|
.appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']);
|
||||||
this.hasReturnValue_ = true;
|
this.hasReturnValue_ = true;
|
||||||
}
|
}
|
||||||
this.setWarningText(null);
|
this.setWarningText(null);
|
||||||
@@ -978,7 +978,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
|
|||||||
this.setDisabled(false);
|
this.setDisabled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING);
|
this.setWarningText(Blockly.Msg['PROCEDURES_IFRETURN_WARNING']);
|
||||||
if (!this.isInFlyout && !this.getInheritedDisabled()) {
|
if (!this.isInFlyout && !this.getInheritedDisabled()) {
|
||||||
this.setDisabled(true);
|
this.setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|||||||
132
blocks/text.js
132
blocks/text.js
@@ -33,7 +33,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.TEXTS_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['TEXTS_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Text.HUE = 160;
|
Blockly.Constants.Text.HUE = 160;
|
||||||
|
|
||||||
@@ -211,31 +211,31 @@ Blockly.Blocks['text_getSubstring'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this['WHERE_OPTIONS_1'] = [
|
this['WHERE_OPTIONS_1'] = [
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START, 'FROM_START'],
|
[Blockly.Msg['TEXT_GET_SUBSTRING_START_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END, 'FROM_END'],
|
[Blockly.Msg['TEXT_GET_SUBSTRING_START_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST, 'FIRST']
|
[Blockly.Msg['TEXT_GET_SUBSTRING_START_FIRST'], 'FIRST']
|
||||||
];
|
];
|
||||||
this['WHERE_OPTIONS_2'] = [
|
this['WHERE_OPTIONS_2'] = [
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START, 'FROM_START'],
|
[Blockly.Msg['TEXT_GET_SUBSTRING_END_FROM_START'], 'FROM_START'],
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END, 'FROM_END'],
|
[Blockly.Msg['TEXT_GET_SUBSTRING_END_FROM_END'], 'FROM_END'],
|
||||||
[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST, 'LAST']
|
[Blockly.Msg['TEXT_GET_SUBSTRING_END_LAST'], 'LAST']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL);
|
this.setHelpUrl(Blockly.Msg['TEXT_GET_SUBSTRING_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.TEXTS_HUE);
|
this.setColour(Blockly.Msg['TEXTS_HUE']);
|
||||||
this.appendValueInput('STRING')
|
this.appendValueInput('STRING')
|
||||||
.setCheck('String')
|
.setCheck('String')
|
||||||
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);
|
.appendField(Blockly.Msg['TEXT_GET_SUBSTRING_INPUT_IN_TEXT']);
|
||||||
this.appendDummyInput('AT1');
|
this.appendDummyInput('AT1');
|
||||||
this.appendDummyInput('AT2');
|
this.appendDummyInput('AT2');
|
||||||
if (Blockly.Msg.TEXT_GET_SUBSTRING_TAIL) {
|
if (Blockly.Msg['TEXT_GET_SUBSTRING_TAIL']) {
|
||||||
this.appendDummyInput('TAIL')
|
this.appendDummyInput('TAIL')
|
||||||
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
|
.appendField(Blockly.Msg['TEXT_GET_SUBSTRING_TAIL']);
|
||||||
}
|
}
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true, 'String');
|
this.setOutput(true, 'String');
|
||||||
this.updateAt_(1, true);
|
this.updateAt_(1, true);
|
||||||
this.updateAt_(2, true);
|
this.updateAt_(2, true);
|
||||||
this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP);
|
this.setTooltip(Blockly.Msg['TEXT_GET_SUBSTRING_TOOLTIP']);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Create XML to represent whether there are 'AT' inputs.
|
* Create XML to represent whether there are 'AT' inputs.
|
||||||
@@ -277,18 +277,18 @@ Blockly.Blocks['text_getSubstring'] = {
|
|||||||
// Create either a value 'AT' input or a dummy input.
|
// Create either a value 'AT' input or a dummy input.
|
||||||
if (isAt) {
|
if (isAt) {
|
||||||
this.appendValueInput('AT' + n).setCheck('Number');
|
this.appendValueInput('AT' + n).setCheck('Number');
|
||||||
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
|
if (Blockly.Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||||
this.appendDummyInput('ORDINAL' + n)
|
this.appendDummyInput('ORDINAL' + n)
|
||||||
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
|
.appendField(Blockly.Msg['ORDINAL_NUMBER_SUFFIX']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.appendDummyInput('AT' + n);
|
this.appendDummyInput('AT' + n);
|
||||||
}
|
}
|
||||||
// Move tail, if present, to end of block.
|
// Move tail, if present, to end of block.
|
||||||
if (n == 2 && Blockly.Msg.TEXT_GET_SUBSTRING_TAIL) {
|
if (n == 2 && Blockly.Msg['TEXT_GET_SUBSTRING_TAIL']) {
|
||||||
this.removeInput('TAIL', true);
|
this.removeInput('TAIL', true);
|
||||||
this.appendDummyInput('TAIL')
|
this.appendDummyInput('TAIL')
|
||||||
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
|
.appendField(Blockly.Msg['TEXT_GET_SUBSTRING_TAIL']);
|
||||||
}
|
}
|
||||||
var menu = new Blockly.FieldDropdown(this['WHERE_OPTIONS_' + n],
|
var menu = new Blockly.FieldDropdown(this['WHERE_OPTIONS_' + n],
|
||||||
function(value) {
|
function(value) {
|
||||||
@@ -324,17 +324,17 @@ Blockly.Blocks['text_changeCase'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
var OPERATORS = [
|
var OPERATORS = [
|
||||||
[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE, 'UPPERCASE'],
|
[Blockly.Msg['TEXT_CHANGECASE_OPERATOR_UPPERCASE'], 'UPPERCASE'],
|
||||||
[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE, 'LOWERCASE'],
|
[Blockly.Msg['TEXT_CHANGECASE_OPERATOR_LOWERCASE'], 'LOWERCASE'],
|
||||||
[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE, 'TITLECASE']
|
[Blockly.Msg['TEXT_CHANGECASE_OPERATOR_TITLECASE'], 'TITLECASE']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL);
|
this.setHelpUrl(Blockly.Msg['TEXT_CHANGECASE_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.TEXTS_HUE);
|
this.setColour(Blockly.Msg['TEXTS_HUE']);
|
||||||
this.appendValueInput('TEXT')
|
this.appendValueInput('TEXT')
|
||||||
.setCheck('String')
|
.setCheck('String')
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'CASE');
|
.appendField(new Blockly.FieldDropdown(OPERATORS), 'CASE');
|
||||||
this.setOutput(true, 'String');
|
this.setOutput(true, 'String');
|
||||||
this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP);
|
this.setTooltip(Blockly.Msg['TEXT_CHANGECASE_TOOLTIP']);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -345,17 +345,17 @@ Blockly.Blocks['text_trim'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
var OPERATORS = [
|
var OPERATORS = [
|
||||||
[Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH, 'BOTH'],
|
[Blockly.Msg['TEXT_TRIM_OPERATOR_BOTH'], 'BOTH'],
|
||||||
[Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT, 'LEFT'],
|
[Blockly.Msg['TEXT_TRIM_OPERATOR_LEFT'], 'LEFT'],
|
||||||
[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT, 'RIGHT']
|
[Blockly.Msg['TEXT_TRIM_OPERATOR_RIGHT'], 'RIGHT']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL);
|
this.setHelpUrl(Blockly.Msg['TEXT_TRIM_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.TEXTS_HUE);
|
this.setColour(Blockly.Msg['TEXTS_HUE']);
|
||||||
this.appendValueInput('TEXT')
|
this.appendValueInput('TEXT')
|
||||||
.setCheck('String')
|
.setCheck('String')
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
|
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
|
||||||
this.setOutput(true, 'String');
|
this.setOutput(true, 'String');
|
||||||
this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP);
|
this.setTooltip(Blockly.Msg['TEXT_TRIM_TOOLTIP']);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ Blockly.Blocks['text_print'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.TEXT_PRINT_TITLE,
|
"message0": Blockly.Msg['TEXT_PRINT_TITLE'],
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
@@ -375,9 +375,9 @@ Blockly.Blocks['text_print'] = {
|
|||||||
],
|
],
|
||||||
"previousStatement": null,
|
"previousStatement": null,
|
||||||
"nextStatement": null,
|
"nextStatement": null,
|
||||||
"colour": Blockly.Msg.TEXTS_HUE,
|
"colour": Blockly.Msg['TEXTS_HUE'],
|
||||||
"tooltip": Blockly.Msg.TEXT_PRINT_TOOLTIP,
|
"tooltip": Blockly.Msg['TEXT_PRINT_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.TEXT_PRINT_HELPURL
|
"helpUrl": Blockly.Msg['TEXT_PRINT_HELPURL']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -389,11 +389,11 @@ Blockly.Blocks['text_prompt_ext'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
var TYPES = [
|
var TYPES = [
|
||||||
[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT, 'TEXT'],
|
[Blockly.Msg['TEXT_PROMPT_TYPE_TEXT'], 'TEXT'],
|
||||||
[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER, 'NUMBER']
|
[Blockly.Msg['TEXT_PROMPT_TYPE_NUMBER'], 'NUMBER']
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);
|
this.setHelpUrl(Blockly.Msg['TEXT_PROMPT_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.TEXTS_HUE);
|
this.setColour(Blockly.Msg['TEXTS_HUE']);
|
||||||
// Assign 'this' to a variable for use in the closures below.
|
// Assign 'this' to a variable for use in the closures below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
|
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
|
||||||
@@ -404,8 +404,8 @@ Blockly.Blocks['text_prompt_ext'] = {
|
|||||||
this.setOutput(true, 'String');
|
this.setOutput(true, 'String');
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
|
return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
|
||||||
Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT :
|
Blockly.Msg['TEXT_PROMPT_TOOLTIP_TEXT'] :
|
||||||
Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER;
|
Blockly.Msg['TEXT_PROMPT_TOOLTIP_NUMBER'];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -446,14 +446,14 @@ Blockly.Blocks['text_prompt'] = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);
|
this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);
|
||||||
var TYPES = [
|
var TYPES = [
|
||||||
[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT, 'TEXT'],
|
[Blockly.Msg['TEXT_PROMPT_TYPE_TEXT'], 'TEXT'],
|
||||||
[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER, 'NUMBER']
|
[Blockly.Msg['TEXT_PROMPT_TYPE_NUMBER'], 'NUMBER']
|
||||||
];
|
];
|
||||||
|
|
||||||
// Assign 'this' to a variable for use in the closures below.
|
// Assign 'this' to a variable for use in the closures below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);
|
this.setHelpUrl(Blockly.Msg['TEXT_PROMPT_HELPURL']);
|
||||||
this.setColour(Blockly.Msg.TEXTS_HUE);
|
this.setColour(Blockly.Msg['TEXTS_HUE']);
|
||||||
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
|
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
|
||||||
thisBlock.updateType_(newOp);
|
thisBlock.updateType_(newOp);
|
||||||
});
|
});
|
||||||
@@ -465,8 +465,8 @@ Blockly.Blocks['text_prompt'] = {
|
|||||||
this.setOutput(true, 'String');
|
this.setOutput(true, 'String');
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
|
return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
|
||||||
Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT :
|
Blockly.Msg['TEXT_PROMPT_TOOLTIP_TEXT'] :
|
||||||
Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER;
|
Blockly.Msg['TEXT_PROMPT_TOOLTIP_NUMBER'];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateType_: Blockly.Blocks['text_prompt_ext'].updateType_,
|
updateType_: Blockly.Blocks['text_prompt_ext'].updateType_,
|
||||||
@@ -481,7 +481,7 @@ Blockly.Blocks['text_count'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.TEXT_COUNT_MESSAGE0,
|
"message0": Blockly.Msg['TEXT_COUNT_MESSAGE0'],
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
@@ -496,9 +496,9 @@ Blockly.Blocks['text_count'] = {
|
|||||||
],
|
],
|
||||||
"output": "Number",
|
"output": "Number",
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"colour": Blockly.Msg.TEXTS_HUE,
|
"colour": Blockly.Msg['TEXTS_HUE'],
|
||||||
"tooltip": Blockly.Msg.TEXT_COUNT_TOOLTIP,
|
"tooltip": Blockly.Msg['TEXT_COUNT_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.TEXT_COUNT_HELPURL
|
"helpUrl": Blockly.Msg['TEXT_COUNT_HELPURL']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -510,7 +510,7 @@ Blockly.Blocks['text_replace'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.TEXT_REPLACE_MESSAGE0,
|
"message0": Blockly.Msg['TEXT_REPLACE_MESSAGE0'],
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
@@ -530,9 +530,9 @@ Blockly.Blocks['text_replace'] = {
|
|||||||
],
|
],
|
||||||
"output": "String",
|
"output": "String",
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"colour": Blockly.Msg.TEXTS_HUE,
|
"colour": Blockly.Msg['TEXTS_HUE'],
|
||||||
"tooltip": Blockly.Msg.TEXT_REPLACE_TOOLTIP,
|
"tooltip": Blockly.Msg['TEXT_REPLACE_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.TEXT_REPLACE_HELPURL
|
"helpUrl": Blockly.Msg['TEXT_REPLACE_HELPURL']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -544,7 +544,7 @@ Blockly.Blocks['text_reverse'] = {
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.TEXT_REVERSE_MESSAGE0,
|
"message0": Blockly.Msg['TEXT_REVERSE_MESSAGE0'],
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
@@ -554,9 +554,9 @@ Blockly.Blocks['text_reverse'] = {
|
|||||||
],
|
],
|
||||||
"output": "String",
|
"output": "String",
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"colour": Blockly.Msg.TEXTS_HUE,
|
"colour": Blockly.Msg['TEXTS_HUE'],
|
||||||
"tooltip": Blockly.Msg.TEXT_REVERSE_TOOLTIP,
|
"tooltip": Blockly.Msg['TEXT_REVERSE_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.TEXT_REVERSE_HELPURL
|
"helpUrl": Blockly.Msg['TEXT_REVERSE_HELPURL']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -753,7 +753,7 @@ Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN = {
|
|||||||
if (!this.getInput('ADD' + i)) {
|
if (!this.getInput('ADD' + i)) {
|
||||||
var input = this.appendValueInput('ADD' + i);
|
var input = this.appendValueInput('ADD' + i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
input.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
|
input.appendField(Blockly.Msg['TEXT_JOIN_TITLE_CREATEWITH']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -792,7 +792,7 @@ Blockly.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION = function() {
|
|||||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
return Blockly.Msg.TEXT_INDEXOF_TOOLTIP.replace('%1',
|
return Blockly.Msg['TEXT_INDEXOF_TOOLTIP'].replace('%1',
|
||||||
thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');
|
thisBlock.workspace.options.oneBasedIndex ? '0' : '-1');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -838,15 +838,15 @@ Blockly.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN = {
|
|||||||
// Create either a value 'AT' input or a dummy input.
|
// Create either a value 'AT' input or a dummy input.
|
||||||
if (isAt) {
|
if (isAt) {
|
||||||
this.appendValueInput('AT').setCheck('Number');
|
this.appendValueInput('AT').setCheck('Number');
|
||||||
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
|
if (Blockly.Msg['ORDINAL_NUMBER_SUFFIX']) {
|
||||||
this.appendDummyInput('ORDINAL')
|
this.appendDummyInput('ORDINAL')
|
||||||
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
|
.appendField(Blockly.Msg['ORDINAL_NUMBER_SUFFIX']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Blockly.Msg.TEXT_CHARAT_TAIL) {
|
if (Blockly.Msg['TEXT_CHARAT_TAIL']) {
|
||||||
this.removeInput('TAIL', true);
|
this.removeInput('TAIL', true);
|
||||||
this.appendDummyInput('TAIL')
|
this.appendDummyInput('TAIL')
|
||||||
.appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
|
.appendField(Blockly.Msg['TEXT_CHARAT_TAIL']);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isAt_ = isAt;
|
this.isAt_ = isAt;
|
||||||
@@ -875,11 +875,11 @@ Blockly.Constants.Text.TEXT_CHARAT_EXTENSION = function() {
|
|||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function() {
|
this.setTooltip(function() {
|
||||||
var where = thisBlock.getFieldValue('WHERE');
|
var where = thisBlock.getFieldValue('WHERE');
|
||||||
var tooltip = Blockly.Msg.TEXT_CHARAT_TOOLTIP;
|
var tooltip = Blockly.Msg['TEXT_CHARAT_TOOLTIP'];
|
||||||
if (where == 'FROM_START' || where == 'FROM_END') {
|
if (where == 'FROM_START' || where == 'FROM_END') {
|
||||||
var msg = (where == 'FROM_START') ?
|
var msg = (where == 'FROM_START') ?
|
||||||
Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP :
|
Blockly.Msg['LISTS_INDEX_FROM_START_TOOLTIP'] :
|
||||||
Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP;
|
Blockly.Msg['LISTS_INDEX_FROM_END_TOOLTIP'];
|
||||||
if (msg) {
|
if (msg) {
|
||||||
tooltip += ' ' + msg.replace('%1',
|
tooltip += ' ' + msg.replace('%1',
|
||||||
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
thisBlock.workspace.options.oneBasedIndex ? '#1' : '#0');
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.VARIABLES_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['VARIABLES_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.Variables.HUE = 330;
|
Blockly.Constants.Variables.HUE = 330;
|
||||||
|
|
||||||
@@ -106,10 +106,10 @@ Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = {
|
|||||||
// Getter blocks have the option to create a setter block, and vice versa.
|
// Getter blocks have the option to create a setter block, and vice versa.
|
||||||
if (this.type == 'variables_get') {
|
if (this.type == 'variables_get') {
|
||||||
var opposite_type = 'variables_set';
|
var opposite_type = 'variables_set';
|
||||||
var contextMenuMsg = Blockly.Msg.VARIABLES_GET_CREATE_SET;
|
var contextMenuMsg = Blockly.Msg['VARIABLES_GET_CREATE_SET'];
|
||||||
} else {
|
} else {
|
||||||
var opposite_type = 'variables_get';
|
var opposite_type = 'variables_get';
|
||||||
var contextMenuMsg = Blockly.Msg.VARIABLES_SET_CREATE_GET;
|
var contextMenuMsg = Blockly.Msg['VARIABLES_SET_CREATE_GET'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var option = {enabled: this.workspace.remainingCapacity() > 0};
|
var option = {enabled: this.workspace.remainingCapacity() > 0};
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ goog.require('Blockly');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unused constant for the common HSV hue for all blocks in this category.
|
* Unused constant for the common HSV hue for all blocks in this category.
|
||||||
* @deprecated Use Blockly.Msg.VARIABLES_DYNAMIC_HUE. (2018 April 5)
|
* @deprecated Use Blockly.Msg['VARIABLES_DYNAMIC_HUE']. (2018 April 5)
|
||||||
*/
|
*/
|
||||||
Blockly.Constants.VariablesDynamic.HUE = 310;
|
Blockly.Constants.VariablesDynamic.HUE = 310;
|
||||||
|
|
||||||
@@ -104,10 +104,10 @@ Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MI
|
|||||||
var contextMenuMsg;
|
var contextMenuMsg;
|
||||||
if (this.type == 'variables_get_dynamic') {
|
if (this.type == 'variables_get_dynamic') {
|
||||||
opposite_type = 'variables_set_dynamic';
|
opposite_type = 'variables_set_dynamic';
|
||||||
contextMenuMsg = Blockly.Msg.VARIABLES_GET_CREATE_SET;
|
contextMenuMsg = Blockly.Msg['VARIABLES_GET_CREATE_SET'];
|
||||||
} else {
|
} else {
|
||||||
opposite_type = 'variables_get_dynamic';
|
opposite_type = 'variables_get_dynamic';
|
||||||
contextMenuMsg = Blockly.Msg.VARIABLES_SET_CREATE_GET;
|
contextMenuMsg = Blockly.Msg['VARIABLES_SET_CREATE_GET'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var option = {enabled: this.workspace.remainingCapacity() > 0};
|
var option = {enabled: this.workspace.remainingCapacity() > 0};
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ Blockly.BlockSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
var inlineOption = {enabled: true};
|
var inlineOption = {enabled: true};
|
||||||
var isInline = this.getInputsInline();
|
var isInline = this.getInputsInline();
|
||||||
inlineOption.text = isInline ?
|
inlineOption.text = isInline ?
|
||||||
Blockly.Msg.EXTERNAL_INPUTS : Blockly.Msg.INLINE_INPUTS;
|
Blockly.Msg['EXTERNAL_INPUTS'] : Blockly.Msg['INLINE_INPUTS'];
|
||||||
inlineOption.callback = function() {
|
inlineOption.callback = function() {
|
||||||
block.setInputsInline(!isInline);
|
block.setInputsInline(!isInline);
|
||||||
};
|
};
|
||||||
@@ -631,14 +631,14 @@ Blockly.BlockSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
// Option to collapse/expand block.
|
// Option to collapse/expand block.
|
||||||
if (this.collapsed_) {
|
if (this.collapsed_) {
|
||||||
var expandOption = {enabled: true};
|
var expandOption = {enabled: true};
|
||||||
expandOption.text = Blockly.Msg.EXPAND_BLOCK;
|
expandOption.text = Blockly.Msg['EXPAND_BLOCK'];
|
||||||
expandOption.callback = function() {
|
expandOption.callback = function() {
|
||||||
block.setCollapsed(false);
|
block.setCollapsed(false);
|
||||||
};
|
};
|
||||||
menuOptions.push(expandOption);
|
menuOptions.push(expandOption);
|
||||||
} else {
|
} else {
|
||||||
var collapseOption = {enabled: true};
|
var collapseOption = {enabled: true};
|
||||||
collapseOption.text = Blockly.Msg.COLLAPSE_BLOCK;
|
collapseOption.text = Blockly.Msg['COLLAPSE_BLOCK'];
|
||||||
collapseOption.callback = function() {
|
collapseOption.callback = function() {
|
||||||
block.setCollapsed(true);
|
block.setCollapsed(true);
|
||||||
};
|
};
|
||||||
@@ -650,7 +650,7 @@ Blockly.BlockSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
// Option to disable/enable block.
|
// Option to disable/enable block.
|
||||||
var disableOption = {
|
var disableOption = {
|
||||||
text: this.disabled ?
|
text: this.disabled ?
|
||||||
Blockly.Msg.ENABLE_BLOCK : Blockly.Msg.DISABLE_BLOCK,
|
Blockly.Msg['ENABLE_BLOCK'] : Blockly.Msg['DISABLE_BLOCK'],
|
||||||
enabled: !this.getInheritedDisabled(),
|
enabled: !this.getInheritedDisabled(),
|
||||||
callback: function() {
|
callback: function() {
|
||||||
block.setDisabled(!block.disabled);
|
block.setDisabled(!block.disabled);
|
||||||
|
|||||||
@@ -633,8 +633,8 @@ Blockly.checkBlockColourConstant_ = function(
|
|||||||
|
|
||||||
if (value && value !== expectedValue) {
|
if (value && value !== expectedValue) {
|
||||||
var warningPattern = (expectedValue === undefined) ?
|
var warningPattern = (expectedValue === undefined) ?
|
||||||
'%1 has been removed. Use Blockly.Msg.%2.' :
|
'%1 has been removed. Use Blockly.Msg["%2"].' :
|
||||||
'%1 is deprecated and unused. Override Blockly.Msg.%2.';
|
'%1 is deprecated and unused. Override Blockly.Msg["%2"].';
|
||||||
var warning = warningPattern.replace('%1', namePath).replace('%2', msgName);
|
var warning = warningPattern.replace('%1', namePath).replace('%2', msgName);
|
||||||
console.warn(warning);
|
console.warn(warning);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ Blockly.ContextMenu.blockDeleteOption = function(block) {
|
|||||||
descendantCount -= nextBlock.getDescendants(false).length;
|
descendantCount -= nextBlock.getDescendants(false).length;
|
||||||
}
|
}
|
||||||
var deleteOption = {
|
var deleteOption = {
|
||||||
text: descendantCount == 1 ? Blockly.Msg.DELETE_BLOCK :
|
text: descendantCount == 1 ? Blockly.Msg['DELETE_BLOCK'] :
|
||||||
Blockly.Msg.DELETE_X_BLOCKS.replace('%1', String(descendantCount)),
|
Blockly.Msg['DELETE_X_BLOCKS'].replace('%1', String(descendantCount)),
|
||||||
enabled: true,
|
enabled: true,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
Blockly.Events.setGroup(true);
|
Blockly.Events.setGroup(true);
|
||||||
@@ -244,7 +244,7 @@ Blockly.ContextMenu.blockHelpOption = function(block) {
|
|||||||
var url = goog.isFunction(block.helpUrl) ? block.helpUrl() : block.helpUrl;
|
var url = goog.isFunction(block.helpUrl) ? block.helpUrl() : block.helpUrl;
|
||||||
var helpOption = {
|
var helpOption = {
|
||||||
enabled: !!url,
|
enabled: !!url,
|
||||||
text: Blockly.Msg.HELP,
|
text: Blockly.Msg['HELP'],
|
||||||
callback: function() {
|
callback: function() {
|
||||||
block.showHelp_();
|
block.showHelp_();
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ Blockly.ContextMenu.blockDuplicateOption = function(block) {
|
|||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
var duplicateOption = {
|
var duplicateOption = {
|
||||||
text: Blockly.Msg.DUPLICATE_BLOCK,
|
text: Blockly.Msg['DUPLICATE_BLOCK'],
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
Blockly.duplicate_(block);
|
Blockly.duplicate_(block);
|
||||||
@@ -287,13 +287,13 @@ Blockly.ContextMenu.blockCommentOption = function(block) {
|
|||||||
};
|
};
|
||||||
// If there's already a comment, add an option to delete it.
|
// If there's already a comment, add an option to delete it.
|
||||||
if (block.comment) {
|
if (block.comment) {
|
||||||
commentOption.text = Blockly.Msg.REMOVE_COMMENT;
|
commentOption.text = Blockly.Msg['REMOVE_COMMENT'];
|
||||||
commentOption.callback = function() {
|
commentOption.callback = function() {
|
||||||
block.setCommentText(null);
|
block.setCommentText(null);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// If there's no comment, add an option to create a comment.
|
// If there's no comment, add an option to create a comment.
|
||||||
commentOption.text = Blockly.Msg.ADD_COMMENT;
|
commentOption.text = Blockly.Msg['ADD_COMMENT'];
|
||||||
commentOption.callback = function() {
|
commentOption.callback = function() {
|
||||||
block.setCommentText('');
|
block.setCommentText('');
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ Blockly.FieldTextInput.prototype.showEditor_ = function(opt_quietInput) {
|
|||||||
*/
|
*/
|
||||||
Blockly.FieldTextInput.prototype.showPromptEditor_ = function() {
|
Blockly.FieldTextInput.prototype.showPromptEditor_ = function() {
|
||||||
var fieldText = this;
|
var fieldText = this;
|
||||||
Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_,
|
Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.text_,
|
||||||
function(newValue) {
|
function(newValue) {
|
||||||
if (fieldText.sourceBlock_) {
|
if (fieldText.sourceBlock_) {
|
||||||
newValue = fieldText.callValidator(newValue);
|
newValue = fieldText.callValidator(newValue);
|
||||||
|
|||||||
@@ -314,11 +314,11 @@ Blockly.FieldVariable.dropdownCreate = function() {
|
|||||||
// Set the UUID as the internal representation of the variable.
|
// Set the UUID as the internal representation of the variable.
|
||||||
options[i] = [variableModelList[i].name, variableModelList[i].getId()];
|
options[i] = [variableModelList[i].name, variableModelList[i].getId()];
|
||||||
}
|
}
|
||||||
options.push([Blockly.Msg.RENAME_VARIABLE, Blockly.RENAME_VARIABLE_ID]);
|
options.push([Blockly.Msg['RENAME_VARIABLE'], Blockly.RENAME_VARIABLE_ID]);
|
||||||
if (Blockly.Msg.DELETE_VARIABLE) {
|
if (Blockly.Msg['DELETE_VARIABLE']) {
|
||||||
options.push(
|
options.push(
|
||||||
[
|
[
|
||||||
Blockly.Msg.DELETE_VARIABLE.replace('%1', name),
|
Blockly.Msg['DELETE_VARIABLE'].replace('%1', name),
|
||||||
Blockly.DELETE_VARIABLE_ID
|
Blockly.DELETE_VARIABLE_ID
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|||||||
block.setAttribute('type', 'procedures_defnoreturn');
|
block.setAttribute('type', 'procedures_defnoreturn');
|
||||||
block.setAttribute('gap', 16);
|
block.setAttribute('gap', 16);
|
||||||
var nameField = goog.dom.createDom('field', null,
|
var nameField = goog.dom.createDom('field', null,
|
||||||
Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE);
|
Blockly.Msg['PROCEDURES_DEFNORETURN_PROCEDURE']);
|
||||||
nameField.setAttribute('name', 'NAME');
|
nameField.setAttribute('name', 'NAME');
|
||||||
block.appendChild(nameField);
|
block.appendChild(nameField);
|
||||||
xmlList.push(block);
|
xmlList.push(block);
|
||||||
@@ -201,7 +201,7 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
|
|||||||
block.setAttribute('type', 'procedures_defreturn');
|
block.setAttribute('type', 'procedures_defreturn');
|
||||||
block.setAttribute('gap', 16);
|
block.setAttribute('gap', 16);
|
||||||
var nameField = goog.dom.createDom('field', null,
|
var nameField = goog.dom.createDom('field', null,
|
||||||
Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE);
|
Blockly.Msg['PROCEDURES_DEFRETURN_PROCEDURE']);
|
||||||
nameField.setAttribute('name', 'NAME');
|
nameField.setAttribute('name', 'NAME');
|
||||||
block.appendChild(nameField);
|
block.appendChild(nameField);
|
||||||
xmlList.push(block);
|
xmlList.push(block);
|
||||||
|
|||||||
@@ -39,19 +39,6 @@ goog.require('goog.math.Coordinate');
|
|||||||
goog.require('goog.userAgent');
|
goog.require('goog.userAgent');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To allow ADVANCED_OPTIMIZATIONS, combining variable.name and variable['name']
|
|
||||||
* is not possible. To access the exported Blockly.Msg.Something it needs to be
|
|
||||||
* accessed through the exact name that was exported. Note, that all the exports
|
|
||||||
* are happening as the last thing in the generated js files, so they won't be
|
|
||||||
* accessible before JavaScript loads!
|
|
||||||
* @return {!Object.<string, string>} The message array.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
Blockly.utils.getMessageArray_ = function() {
|
|
||||||
return goog.global['Blockly']['Msg'];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an attribute from a element even if it's in IE 10.
|
* Remove an attribute from a element even if it's in IE 10.
|
||||||
* Similar to Element.removeAttribute() but it works on SVG elements in IE 10.
|
* Similar to Element.removeAttribute() but it works on SVG elements in IE 10.
|
||||||
@@ -435,7 +422,7 @@ Blockly.utils.replaceMessageReferences = function(message) {
|
|||||||
Blockly.utils.checkMessageReferences = function(message) {
|
Blockly.utils.checkMessageReferences = function(message) {
|
||||||
var validSoFar = true;
|
var validSoFar = true;
|
||||||
|
|
||||||
var msgTable = Blockly.utils.getMessageArray_();
|
var msgTable = Blockly.Msg;
|
||||||
|
|
||||||
// TODO(#1169): Implement support for other string tables, prefixes other than BKY_.
|
// TODO(#1169): Implement support for other string tables, prefixes other than BKY_.
|
||||||
var regex = /%{(BKY_[A-Z][A-Z0-9_]*)}/gi;
|
var regex = /%{(BKY_[A-Z][A-Z0-9_]*)}/gi;
|
||||||
@@ -540,8 +527,8 @@ Blockly.utils.tokenizeInterpolation_ = function(message,
|
|||||||
// are defined in ../msgs/ files.
|
// are defined in ../msgs/ files.
|
||||||
var bklyKey = goog.string.startsWith(keyUpper, 'BKY_') ?
|
var bklyKey = goog.string.startsWith(keyUpper, 'BKY_') ?
|
||||||
keyUpper.substring(4) : null;
|
keyUpper.substring(4) : null;
|
||||||
if (bklyKey && bklyKey in Blockly.utils.getMessageArray_()) {
|
if (bklyKey && bklyKey in Blockly.Msg) {
|
||||||
var rawValue = Blockly.utils.getMessageArray_()[bklyKey];
|
var rawValue = Blockly.Msg[bklyKey];
|
||||||
if (goog.isString(rawValue)) {
|
if (goog.isString(rawValue)) {
|
||||||
// Attempt to dereference substrings, too, appending to the end.
|
// Attempt to dereference substrings, too, appending to the end.
|
||||||
Array.prototype.push.apply(tokens,
|
Array.prototype.push.apply(tokens,
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ Blockly.VariableMap.prototype.deleteVariableById = function(id) {
|
|||||||
if (block.type == 'procedures_defnoreturn' ||
|
if (block.type == 'procedures_defnoreturn' ||
|
||||||
block.type == 'procedures_defreturn') {
|
block.type == 'procedures_defreturn') {
|
||||||
var procedureName = block.getFieldValue('NAME');
|
var procedureName = block.getFieldValue('NAME');
|
||||||
var deleteText = Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.
|
var deleteText = Blockly.Msg['CANNOT_DELETE_VARIABLE_PROCEDURE'].
|
||||||
replace('%1', variableName).
|
replace('%1', variableName).
|
||||||
replace('%2', procedureName);
|
replace('%2', procedureName);
|
||||||
Blockly.alert(deleteText);
|
Blockly.alert(deleteText);
|
||||||
@@ -241,7 +241,7 @@ Blockly.VariableMap.prototype.deleteVariableById = function(id) {
|
|||||||
var map = this;
|
var map = this;
|
||||||
if (uses.length > 1) {
|
if (uses.length > 1) {
|
||||||
// Confirm before deleting multiple blocks.
|
// Confirm before deleting multiple blocks.
|
||||||
var confirmText = Blockly.Msg.DELETE_VARIABLE_CONFIRMATION.
|
var confirmText = Blockly.Msg['DELETE_VARIABLE_CONFIRMATION'].
|
||||||
replace('%1', String(uses.length)).
|
replace('%1', String(uses.length)).
|
||||||
replace('%2', variableName);
|
replace('%2', variableName);
|
||||||
Blockly.confirm(confirmText,
|
Blockly.confirm(confirmText,
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ Blockly.Variables.allDeveloperVariables = function(workspace) {
|
|||||||
Blockly.Variables.flyoutCategory = function(workspace) {
|
Blockly.Variables.flyoutCategory = function(workspace) {
|
||||||
var xmlList = [];
|
var xmlList = [];
|
||||||
var button = goog.dom.createDom('button');
|
var button = goog.dom.createDom('button');
|
||||||
button.setAttribute('text', Blockly.Msg.NEW_VARIABLE);
|
button.setAttribute('text', Blockly.Msg['NEW_VARIABLE']);
|
||||||
button.setAttribute('callbackKey', 'CREATE_VARIABLE');
|
button.setAttribute('callbackKey', 'CREATE_VARIABLE');
|
||||||
|
|
||||||
workspace.registerButtonCallback('CREATE_VARIABLE', function(button) {
|
workspace.registerButtonCallback('CREATE_VARIABLE', function(button) {
|
||||||
@@ -267,7 +267,7 @@ Blockly.Variables.createVariableButtonHandler = function(
|
|||||||
var type = opt_type || '';
|
var type = opt_type || '';
|
||||||
// This function needs to be named so it can be called recursively.
|
// This function needs to be named so it can be called recursively.
|
||||||
var promptAndCheckWithAlert = function(defaultName) {
|
var promptAndCheckWithAlert = function(defaultName) {
|
||||||
Blockly.Variables.promptName(Blockly.Msg.NEW_VARIABLE_TITLE, defaultName,
|
Blockly.Variables.promptName(Blockly.Msg['NEW_VARIABLE_TITLE'], defaultName,
|
||||||
function(text) {
|
function(text) {
|
||||||
if (text) {
|
if (text) {
|
||||||
var existing =
|
var existing =
|
||||||
@@ -275,10 +275,10 @@ Blockly.Variables.createVariableButtonHandler = function(
|
|||||||
if (existing) {
|
if (existing) {
|
||||||
var lowerCase = text.toLowerCase();
|
var lowerCase = text.toLowerCase();
|
||||||
if (existing.type == type) {
|
if (existing.type == type) {
|
||||||
var msg = Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace(
|
var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS'].replace(
|
||||||
'%1', lowerCase);
|
'%1', lowerCase);
|
||||||
} else {
|
} else {
|
||||||
var msg = Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE;
|
var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE'];
|
||||||
msg = msg.replace('%1', lowerCase).replace('%2', existing.type);
|
msg = msg.replace('%1', lowerCase).replace('%2', existing.type);
|
||||||
}
|
}
|
||||||
Blockly.alert(msg,
|
Blockly.alert(msg,
|
||||||
@@ -336,14 +336,14 @@ Blockly.Variables.renameVariable = function(workspace, variable,
|
|||||||
// This function needs to be named so it can be called recursively.
|
// This function needs to be named so it can be called recursively.
|
||||||
var promptAndCheckWithAlert = function(defaultName) {
|
var promptAndCheckWithAlert = function(defaultName) {
|
||||||
var promptText =
|
var promptText =
|
||||||
Blockly.Msg.RENAME_VARIABLE_TITLE.replace('%1', variable.name);
|
Blockly.Msg['RENAME_VARIABLE_TITLE'].replace('%1', variable.name);
|
||||||
Blockly.Variables.promptName(promptText, defaultName,
|
Blockly.Variables.promptName(promptText, defaultName,
|
||||||
function(newName) {
|
function(newName) {
|
||||||
if (newName) {
|
if (newName) {
|
||||||
var existing = Blockly.Variables.nameUsedWithOtherType_(newName,
|
var existing = Blockly.Variables.nameUsedWithOtherType_(newName,
|
||||||
variable.type, workspace);
|
variable.type, workspace);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
var msg = Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE
|
var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE']
|
||||||
.replace('%1', newName.toLowerCase())
|
.replace('%1', newName.toLowerCase())
|
||||||
.replace('%2', existing.type);
|
.replace('%2', existing.type);
|
||||||
Blockly.alert(msg,
|
Blockly.alert(msg,
|
||||||
@@ -380,8 +380,8 @@ Blockly.Variables.promptName = function(promptText, defaultText, callback) {
|
|||||||
// Beyond this, all names are legal.
|
// Beyond this, all names are legal.
|
||||||
if (newVar) {
|
if (newVar) {
|
||||||
newVar = newVar.replace(/[\s\xa0]+/g, ' ').replace(/^ | $/g, '');
|
newVar = newVar.replace(/[\s\xa0]+/g, ' ').replace(/^ | $/g, '');
|
||||||
if (newVar == Blockly.Msg.RENAME_VARIABLE ||
|
if (newVar == Blockly.Msg['RENAME_VARIABLE'] ||
|
||||||
newVar == Blockly.Msg.NEW_VARIABLE) {
|
newVar == Blockly.Msg['NEW_VARIABLE']) {
|
||||||
// Ok, not ALL names are legal...
|
// Ok, not ALL names are legal...
|
||||||
newVar = null;
|
newVar = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,14 +54,14 @@ Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour = function(button) {
|
|||||||
Blockly.VariablesDynamic.flyoutCategory = function(workspace) {
|
Blockly.VariablesDynamic.flyoutCategory = function(workspace) {
|
||||||
var xmlList = [];
|
var xmlList = [];
|
||||||
var button = goog.dom.createDom('button');
|
var button = goog.dom.createDom('button');
|
||||||
button.setAttribute('text', Blockly.Msg.NEW_STRING_VARIABLE);
|
button.setAttribute('text', Blockly.Msg['NEW_STRING_VARIABLE']);
|
||||||
button.setAttribute('callbackKey', 'CREATE_VARIABLE_STRING');
|
button.setAttribute('callbackKey', 'CREATE_VARIABLE_STRING');
|
||||||
xmlList.push(button);
|
xmlList.push(button);
|
||||||
button = goog.dom.createDom('button');
|
button = goog.dom.createDom('button');
|
||||||
button.setAttribute('text', Blockly.Msg.NEW_NUMBER_VARIABLE);
|
button.setAttribute('text', Blockly.Msg['NEW_NUMBER_VARIABLE']);
|
||||||
button.setAttribute('callbackKey', 'CREATE_VARIABLE_NUMBER');
|
button.setAttribute('callbackKey', 'CREATE_VARIABLE_NUMBER');
|
||||||
xmlList.push(button);button = goog.dom.createDom('button');
|
xmlList.push(button);button = goog.dom.createDom('button');
|
||||||
button.setAttribute('text', Blockly.Msg.NEW_COLOUR_VARIABLE);
|
button.setAttribute('text', Blockly.Msg['NEW_COLOUR_VARIABLE']);
|
||||||
button.setAttribute('callbackKey', 'CREATE_VARIABLE_COLOUR');
|
button.setAttribute('callbackKey', 'CREATE_VARIABLE_COLOUR');
|
||||||
xmlList.push(button);
|
xmlList.push(button);
|
||||||
|
|
||||||
|
|||||||
@@ -1193,12 +1193,12 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
|
|
||||||
// Options to undo/redo previous action.
|
// Options to undo/redo previous action.
|
||||||
var undoOption = {};
|
var undoOption = {};
|
||||||
undoOption.text = Blockly.Msg.UNDO;
|
undoOption.text = Blockly.Msg['UNDO'];
|
||||||
undoOption.enabled = this.undoStack_.length > 0;
|
undoOption.enabled = this.undoStack_.length > 0;
|
||||||
undoOption.callback = this.undo.bind(this, false);
|
undoOption.callback = this.undo.bind(this, false);
|
||||||
menuOptions.push(undoOption);
|
menuOptions.push(undoOption);
|
||||||
var redoOption = {};
|
var redoOption = {};
|
||||||
redoOption.text = Blockly.Msg.REDO;
|
redoOption.text = Blockly.Msg['REDO'];
|
||||||
redoOption.enabled = this.redoStack_.length > 0;
|
redoOption.enabled = this.redoStack_.length > 0;
|
||||||
redoOption.callback = this.undo.bind(this, true);
|
redoOption.callback = this.undo.bind(this, true);
|
||||||
menuOptions.push(redoOption);
|
menuOptions.push(redoOption);
|
||||||
@@ -1206,7 +1206,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
// Option to clean up blocks.
|
// Option to clean up blocks.
|
||||||
if (this.scrollbar) {
|
if (this.scrollbar) {
|
||||||
var cleanOption = {};
|
var cleanOption = {};
|
||||||
cleanOption.text = Blockly.Msg.CLEAN_UP;
|
cleanOption.text = Blockly.Msg['CLEAN_UP'];
|
||||||
cleanOption.enabled = topBlocks.length > 1;
|
cleanOption.enabled = topBlocks.length > 1;
|
||||||
cleanOption.callback = this.cleanUp.bind(this);
|
cleanOption.callback = this.cleanUp.bind(this);
|
||||||
menuOptions.push(cleanOption);
|
menuOptions.push(cleanOption);
|
||||||
@@ -1248,7 +1248,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
|
|
||||||
// Option to collapse top blocks.
|
// Option to collapse top blocks.
|
||||||
var collapseOption = {enabled: hasExpandedBlocks};
|
var collapseOption = {enabled: hasExpandedBlocks};
|
||||||
collapseOption.text = Blockly.Msg.COLLAPSE_ALL;
|
collapseOption.text = Blockly.Msg['COLLAPSE_ALL'];
|
||||||
collapseOption.callback = function() {
|
collapseOption.callback = function() {
|
||||||
toggleOption(true);
|
toggleOption(true);
|
||||||
};
|
};
|
||||||
@@ -1256,7 +1256,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
|
|
||||||
// Option to expand top blocks.
|
// Option to expand top blocks.
|
||||||
var expandOption = {enabled: hasCollapsedBlocks};
|
var expandOption = {enabled: hasCollapsedBlocks};
|
||||||
expandOption.text = Blockly.Msg.EXPAND_ALL;
|
expandOption.text = Blockly.Msg['EXPAND_ALL'];
|
||||||
expandOption.callback = function() {
|
expandOption.callback = function() {
|
||||||
toggleOption(false);
|
toggleOption(false);
|
||||||
};
|
};
|
||||||
@@ -1295,8 +1295,8 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var deleteOption = {
|
var deleteOption = {
|
||||||
text: deleteList.length == 1 ? Blockly.Msg.DELETE_BLOCK :
|
text: deleteList.length == 1 ? Blockly.Msg['DELETE_BLOCK'] :
|
||||||
Blockly.Msg.DELETE_X_BLOCKS.replace('%1', String(deleteList.length)),
|
Blockly.Msg['DELETE_X_BLOCKS'].replace('%1', String(deleteList.length)),
|
||||||
enabled: deleteList.length > 0,
|
enabled: deleteList.length > 0,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
if (ws.currentGesture_) {
|
if (ws.currentGesture_) {
|
||||||
@@ -1306,7 +1306,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
|||||||
deleteNext();
|
deleteNext();
|
||||||
} else {
|
} else {
|
||||||
Blockly.confirm(
|
Blockly.confirm(
|
||||||
Blockly.Msg.DELETE_ALL_BLOCKS.replace('%1', deleteList.length),
|
Blockly.Msg['DELETE_ALL_BLOCKS'].replace('%1', deleteList.length),
|
||||||
function(ok) {
|
function(ok) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
deleteNext();
|
deleteNext();
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ Code.runJS = function() {
|
|||||||
Code.discard = function() {
|
Code.discard = function() {
|
||||||
var count = Code.workspace.getAllBlocks().length;
|
var count = Code.workspace.getAllBlocks().length;
|
||||||
if (count < 2 ||
|
if (count < 2 ||
|
||||||
window.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace('%1', count))) {
|
window.confirm(Blockly.Msg['DELETE_ALL_BLOCKS'].replace('%1', count))) {
|
||||||
Code.workspace.clear();
|
Code.workspace.clear();
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
window.location.hash = '';
|
window.location.hash = '';
|
||||||
|
|||||||
@@ -196,9 +196,9 @@ Blockly.defineBlocksWithJsonArray([{
|
|||||||
"type": "graph_get_x",
|
"type": "graph_get_x",
|
||||||
"message0": "x",
|
"message0": "x",
|
||||||
"output": "Number",
|
"output": "Number",
|
||||||
"colour": Blockly.Msg.VARIABLES_HUE,
|
"colour": Blockly.Msg['VARIABLES_HUE'],
|
||||||
"tooltip": Blockly.Msg.VARIABLES_GET_TOOLTIP,
|
"tooltip": Blockly.Msg['VARIABLES_GET_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.VARIABLES_GET_HELPURL
|
"helpUrl": Blockly.Msg['VARIABLES_GET_HELPURL']
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
Blockly.JavaScript['graph_get_x'] = function(block) {
|
Blockly.JavaScript['graph_get_x'] = function(block) {
|
||||||
@@ -216,9 +216,9 @@ Blockly.defineBlocksWithJsonArray([{
|
|||||||
"check": "Number"
|
"check": "Number"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"colour": Blockly.Msg.VARIABLES_HUE,
|
"colour": Blockly.Msg['VARIABLES_HUE'],
|
||||||
"tooltip": Blockly.Msg.VARIABLES_SET_TOOLTIP,
|
"tooltip": Blockly.Msg['VARIABLES_SET_TOOLTIP'],
|
||||||
"helpUrl": Blockly.Msg.VARIABLES_SET_HELPURL
|
"helpUrl": Blockly.Msg['VARIABLES_SET_HELPURL']
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
Blockly.JavaScript['graph_set_y'] = function(block) {
|
Blockly.JavaScript['graph_set_y'] = function(block) {
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
Blockly.Blocks['plane_set_seats'] = {
|
Blockly.Blocks['plane_set_seats'] = {
|
||||||
// Block seat variable setter.
|
// Block seat variable setter.
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setHelpUrl(Blockly.Msg.VARIABLES_SET_HELPURL);
|
this.setHelpUrl(Blockly.Msg['VARIABLES_SET_HELPURL']);
|
||||||
this.setColour(330);
|
this.setColour(330);
|
||||||
this.appendValueInput('VALUE')
|
this.appendValueInput('VALUE')
|
||||||
.appendField(Plane.getMsg('Plane_setSeats'));
|
.appendField(Plane.getMsg('Plane_setSeats'));
|
||||||
this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);
|
this.setTooltip(Blockly.Msg['VARIABLES_SET_TOOLTIP']);
|
||||||
this.setDeletable(false);
|
this.setDeletable(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -45,7 +45,7 @@ Blockly.JavaScript['plane_set_seats'] = function(block) {
|
|||||||
Blockly.Blocks['plane_get_rows'] = {
|
Blockly.Blocks['plane_get_rows'] = {
|
||||||
// Block for row variable getter.
|
// Block for row variable getter.
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
|
this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']);
|
||||||
this.setColour(330);
|
this.setColour(330);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Plane.getMsg('Plane_getRows'), 'title');
|
.appendField(Plane.getMsg('Plane_getRows'), 'title');
|
||||||
@@ -65,7 +65,7 @@ Blockly.JavaScript['plane_get_rows'] = function(block) {
|
|||||||
Blockly.Blocks['plane_get_rows1st'] = {
|
Blockly.Blocks['plane_get_rows1st'] = {
|
||||||
// Block for first class row variable getter.
|
// Block for first class row variable getter.
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
|
this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']);
|
||||||
this.setColour(330);
|
this.setColour(330);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Plane.getMsg('Plane_getRows1'), 'title');
|
.appendField(Plane.getMsg('Plane_getRows1'), 'title');
|
||||||
@@ -85,7 +85,7 @@ Blockly.JavaScript['plane_get_rows1st'] = function(block) {
|
|||||||
Blockly.Blocks['plane_get_rows2nd'] = {
|
Blockly.Blocks['plane_get_rows2nd'] = {
|
||||||
// Block for second class row variable getter.
|
// Block for second class row variable getter.
|
||||||
init: function() {
|
init: function() {
|
||||||
this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
|
this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']);
|
||||||
this.setColour(330);
|
this.setColour(330);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Plane.getMsg('Plane_getRows2'), 'title');
|
.appendField(Plane.getMsg('Plane_getRows2'), 'title');
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ def load_constants(filename):
|
|||||||
for key in constant_defs:
|
for key in constant_defs:
|
||||||
value = constant_defs[key]
|
value = constant_defs[key]
|
||||||
value = value.replace('"', '\\"')
|
value = value.replace('"', '\\"')
|
||||||
constants_text += u'\n/** @export */ Blockly.Msg.{0} = \"{1}\";'.format(
|
constants_text += u'\nBlockly.Msg["{0}"] = \"{1}\";'.format(
|
||||||
key, value)
|
key, value)
|
||||||
return constants_text
|
return constants_text
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ def main():
|
|||||||
# Read in synonyms file, which must be output in every language.
|
# Read in synonyms file, which must be output in every language.
|
||||||
synonym_defs = read_json_file(os.path.join(
|
synonym_defs = read_json_file(os.path.join(
|
||||||
os.curdir, args.source_synonym_file))
|
os.curdir, args.source_synonym_file))
|
||||||
synonym_text = '\n'.join([u'/** @export */ Blockly.Msg.{0} = Blockly.Msg.{1};'
|
synonym_text = '\n'.join([u'Blockly.Msg["{0}"] = Blockly.Msg["{1}"];'
|
||||||
.format(key, synonym_defs[key]) for key in synonym_defs])
|
.format(key, synonym_defs[key]) for key in synonym_defs])
|
||||||
|
|
||||||
# Read in constants file, which must be output in every language.
|
# Read in constants file, which must be output in every language.
|
||||||
@@ -140,7 +140,7 @@ goog.require('Blockly.Msg');
|
|||||||
value = source_defs[key]
|
value = source_defs[key]
|
||||||
comment = ' // untranslated'
|
comment = ' // untranslated'
|
||||||
value = value.replace('"', '\\"')
|
value = value.replace('"', '\\"')
|
||||||
outfile.write(u'/** @export */ Blockly.Msg.{0} = "{1}";{2}\n'
|
outfile.write(u'Blockly.Msg["{0}"] = "{1}";{2}\n'
|
||||||
.format(key, value, comment))
|
.format(key, value, comment))
|
||||||
|
|
||||||
# Announce any keys defined only for target language.
|
# Announce any keys defined only for target language.
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ import re
|
|||||||
from common import write_files
|
from common import write_files
|
||||||
|
|
||||||
|
|
||||||
_INPUT_DEF_PATTERN = re.compile("""Blockly.Msg.(\w*)\s*=\s*'(.*)';?\r?$""")
|
_INPUT_DEF_PATTERN = re.compile("""Blockly.Msg\[(\w*)\]\s*=\s*'(.*)';?\r?$""")
|
||||||
|
|
||||||
_INPUT_SYN_PATTERN = re.compile(
|
_INPUT_SYN_PATTERN = re.compile(
|
||||||
"""Blockly.Msg.(\w*)\s*=\s*Blockly.Msg.(\w*);""")
|
"""Blockly.Msg\[(\w*)\]\s*=\s*Blockly.Msg\[(\w*)\];""")
|
||||||
|
|
||||||
_CONSTANT_DESCRIPTION_PATTERN = re.compile(
|
_CONSTANT_DESCRIPTION_PATTERN = re.compile(
|
||||||
"""{{Notranslate}}""", re.IGNORECASE)
|
"""{{Notranslate}}""", re.IGNORECASE)
|
||||||
|
|||||||
Reference in New Issue
Block a user