Merge pull request #3224 from zochris/variable-exists-phrasing

Rephrase "variable already exists" message
This commit is contained in:
Rachel Fenichel
2019-10-16 12:37:15 -06:00
committed by GitHub

View File

@@ -283,14 +283,13 @@ Blockly.Variables.createVariableButtonHandler = function(
var existing =
Blockly.Variables.nameUsedWithAnyType_(text, workspace);
if (existing) {
var lowerCase = text.toLowerCase();
if (existing.type == type) {
var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS'].replace(
'%1', lowerCase);
'%1', existing.name);
} else {
var msg =
Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE'];
msg = msg.replace('%1', lowerCase).replace('%2', existing.type);
msg = msg.replace('%1', existing.name).replace('%2', existing.type);
}
Blockly.alert(msg,
function() {
@@ -351,7 +350,7 @@ Blockly.Variables.renameVariable = function(workspace, variable,
variable.type, workspace);
if (existing) {
var msg = Blockly.Msg['VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE']
.replace('%1', newName.toLowerCase())
.replace('%1', existing.name)
.replace('%2', existing.type);
Blockly.alert(msg,
function() {