Skip to content

Use different text for variable and list deletion/renaming #1750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions core/field_variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,20 @@ Blockly.FieldVariable.dropdownCreate = function() {
options.unshift(
[Blockly.Msg.NEW_BROADCAST_MESSAGE, Blockly.NEW_BROADCAST_MESSAGE_ID]);
} else {
options.push([Blockly.Msg.RENAME_VARIABLE, Blockly.RENAME_VARIABLE_ID]);
if (Blockly.Msg.DELETE_VARIABLE) {
// Scalar variables and lists have the same backing action, but the option
// text is different.
if (this.defaultType_ == Blockly.LIST_VARIABLE_TYPE) {
var renameText = Blockly.Msg.RENAME_LIST;
var deleteText = Blockly.Msg.DELETE_LIST;
} else {
var renameText = Blockly.Msg.RENAME_VARIABLE;
var deleteText = Blockly.Msg.DELETE_VARIABLE;
}
options.push([renameText, Blockly.RENAME_VARIABLE_ID]);
if (deleteText) {
options.push(
[
Blockly.Msg.DELETE_VARIABLE.replace('%1', name),
deleteText.replace('%1', name),
Blockly.DELETE_VARIABLE_ID
]);
}
Expand Down
2 changes: 2 additions & 0 deletions msg/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ Blockly.Msg.LIST_ALREADY_EXISTS = 'A list named "%1" already exists.';
Blockly.Msg.RENAME_LIST_TITLE = 'Rename all "%1" lists to:';
Blockly.Msg.RENAME_LIST_MODAL_TITLE = 'Rename List';
Blockly.Msg.DEFAULT_LIST_ITEM = 'thing';
Blockly.Msg.DELETE_LIST = 'Delete the "%1" list';
Blockly.Msg.RENAME_LIST = 'Rename list';

// Broadcast Messages
// @todo Remove these once fully managed by Scratch VM / Scratch GUI
Expand Down